diff --git a/packages/thing-contract/src/codecs.ts b/packages/thing-contract/src/codecs.ts index c8dfc1c..e2030c6 100644 --- a/packages/thing-contract/src/codecs.ts +++ b/packages/thing-contract/src/codecs.ts @@ -273,6 +273,8 @@ export const commandInvocation = codecs.slots( 6: ["client", text], 7: ["issuedAt", text], 8: ["delegation", nullable(string)], + 9: ["source", text], + 10: ["items", readOnlyList(string)], }, named("CommandInvocation"), ); diff --git a/packages/thing-contract/src/types.ts b/packages/thing-contract/src/types.ts index 40155a9..688dadc 100644 --- a/packages/thing-contract/src/types.ts +++ b/packages/thing-contract/src/types.ts @@ -155,6 +155,14 @@ export interface CommandInvocation { readonly client: string; readonly issuedAt: string; readonly delegation: string | null; + /** + * The activating node's declared id in the resolved tree. For a node inside a Repeat it is the template's + * id, never an instance id. A confirmed invocation names the node confirmed; a resumed one carries the + * source and items of the invocation whose result carried the effect. + */ + readonly source: NodeId; + /** The key of each Repeat instance enclosing the source, outermost first; empty outside any Repeat. */ + readonly items: readonly string[]; } // result.rs diff --git a/packages/thing-contract/test/builders.ts b/packages/thing-contract/test/builders.ts index f343de4..94bdf9a 100644 --- a/packages/thing-contract/test/builders.ts +++ b/packages/thing-contract/test/builders.ts @@ -139,6 +139,8 @@ export function invocation(): CommandInvocation { client: "renderer.web", issuedAt: PINNED_CLOCK, delegation: "delegate-1", + source: "go-button", + items: ["outer", "inner"], }; }