diff --git a/Makefile.toml b/Makefile.toml index dce595a801..09c847181a 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -374,6 +374,7 @@ install_crate = "clippy" command = "cargo" args = [ "clippy", + "--all-targets", "--fix", "--allow-dirty", "--allow-staged", diff --git a/cli/golem-cli/wit/deps/golem-1.x/golem-host.wit b/cli/golem-cli/wit/deps/golem-1.x/golem-host.wit index db737a53c2..af5cd62fd3 100644 --- a/cli/golem-cli/wit/deps/golem-1.x/golem-host.wit +++ b/cli/golem-cli/wit/deps/golem-1.x/golem-host.wit @@ -196,12 +196,19 @@ interface host { revert-last-invocations(u64) } - /// Indicates which agent the code is running on after `fork` - enum fork-result { + /// Details about the fork result + record fork-details { + forked-phantom-id: uuid, + } + + /// Indicates which agent the code is running on after `fork`. + /// The parameter contains details about the fork result, such as the phantom-ID of the newly + /// created agent. + variant fork-result { /// The original agent that called `fork` - original, + original(fork-details), /// The new agent - forked + forked(fork-details) } resource get-promise-result { @@ -305,10 +312,11 @@ interface host { /// Returns none when no component for the specified component-reference or no agent with the specified agent-name exists. resolve-agent-id-strict: func(component-reference: string, agent-name: string) -> option; - /// Forks the current agent at the current execution point. The new agent gets the `new-name` agent ID, - /// and this agent continues running as well. The return value is going to be different in this agent and - /// the forked agent. - fork: func(new-name: string) -> fork-result; + /// Forks the current agent at the current execution point. The new agent gets the same base agent ID but + /// with a new unique phantom ID. The phantom ID of the forked agent is returned in `fork-result` on + /// both sides. The newly created agent continues running from the same point, but the return value is + /// going to be different in this agent and the forked agent. + fork: func() -> fork-result; } /// Interface providing user-defined snapshotting capability. This can be used to perform manual update of agents diff --git a/cli/golem-cli/wit/deps/golem-agent/host.wit b/cli/golem-cli/wit/deps/golem-agent/host.wit index f6c2103932..c8070cb027 100644 --- a/cli/golem-cli/wit/deps/golem-agent/host.wit +++ b/cli/golem-cli/wit/deps/golem-agent/host.wit @@ -1,7 +1,7 @@ package golem:agent; interface host { - use golem:rpc/types@0.2.2.{component-id}; + use golem:rpc/types@0.2.2.{component-id, uuid}; use common.{agent-error, agent-type, data-value}; /// Associates an agent type with a component that implements it @@ -17,8 +17,10 @@ interface host { get-agent-type: func(agent-type-name: string) -> option; /// Constructs a string agent-id from the agent type and its constructor parameters - make-agent-id: func(agent-type-name: string, input: data-value) -> result; + /// and an optional phantom ID + make-agent-id: func(agent-type-name: string, input: data-value, phantom-id: option) -> result; /// Parses an agent-id (created by `make-agent-id`) into an agent type name and its constructor parameters - parse-agent-id: func(agent-id: string) -> result, agent-error>; + /// and an optional phantom ID + parse-agent-id: func(agent-id: string) -> result>, agent-error>; } diff --git a/cli/golem-templates/src/lib.rs b/cli/golem-templates/src/lib.rs index 8ec00afd71..049ae4af44 100644 --- a/cli/golem-templates/src/lib.rs +++ b/cli/golem-templates/src/lib.rs @@ -45,7 +45,7 @@ static APP_MANIFEST_HEADER: &str = indoc! {" "}; static GOLEM_RUST_VERSION: &str = "1.9.0"; -static GOLEM_TS_VERSION: &str = "0.0.60"; +static GOLEM_TS_VERSION: &str = "0.0.63"; fn all_templates(dev_mode: bool) -> Vec