@ziggs-ai/agent-sdk 0.43.4 → 0.43.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.43.5
6
+
7
+ - A task's input bodies (0.43.4) now actually reach a hosted workflow agent. The agent pins every context read in a wake to that wake's work, and that pin also dropped the artifact the input read named, so the read came back without a body. A read may now narrow to one artifact of the same task or agreement; any other read still gets the wake's own scope.
8
+
5
9
  ## 0.43.4
6
10
 
7
11
  - A workflow agent working an assigned task now sees the bodies of the task's input artifacts. The work snapshot names a task's inputs without their text, and a workflow agent has no artifact-reading tool, so a delegated task arrived with its instructions out of reach and the agent failed it. Each input (up to three) is read through the same grant-checked context read and shown in the prompt as `<task-inputs>`. An input the agent may not read is left out.
package/dist/Agent.d.ts CHANGED
@@ -522,3 +522,11 @@ export declare class Agent {
522
522
  export declare function createAgent(options?: AgentOptions | AgentConfig): Agent;
523
523
  export declare function createAgentPool(configs: AgentOptions[] | AgentConfig[]): Promise<unknown>;
524
524
  export default Agent;
525
+ type ReadScope = NonNullable<import('./types.js').ReadContextOpts['workScopes']>[number];
526
+ /**
527
+ * A read inside a wake stays on that wake's work. A caller may only narrow it
528
+ * to one artifact of the same task or agreement, which is how a task's input
529
+ * is opened with its body. Anything else reads the wake's own scopes. The
530
+ * server still checks every read.
531
+ */
532
+ export declare function readScopesForWake(asked: ReadScope[] | undefined, wake: ReadScope[]): ReadScope[];
package/dist/Agent.js CHANGED
@@ -1331,7 +1331,7 @@ export class Agent {
1331
1331
  const agreementId = marks.scope.agreementId;
1332
1332
  const sameRoom = 'sessionId' in effect && effect.sessionId === session.sessionId;
1333
1333
  const scopedEffect = sameRoom && effect.kind === 'read-context'
1334
- ? { ...effect, opts: { ...effect.opts, workScopes: contextScopesFromWake(frame, session.sessionId) } }
1334
+ ? { ...effect, opts: { ...effect.opts, workScopes: readScopesForWake(effect.opts?.workScopes, contextScopesFromWake(frame, session.sessionId)) } }
1335
1335
  : agreementId && (effect.kind === 'tool-call' || effect.kind === 'record-event')
1336
1336
  ? { ...effect, serviceAgreementId: effect.serviceAgreementId ?? agreementId }
1337
1337
  : effect;
@@ -1894,3 +1894,21 @@ export async function createAgentPool(configs) {
1894
1894
  }
1895
1895
  }
1896
1896
  export default Agent;
1897
+ /**
1898
+ * A read inside a wake stays on that wake's work. A caller may only narrow it
1899
+ * to one artifact of the same task or agreement, which is how a task's input
1900
+ * is opened with its body. Anything else reads the wake's own scopes. The
1901
+ * server still checks every read.
1902
+ */
1903
+ export function readScopesForWake(asked, wake) {
1904
+ if (!asked?.length)
1905
+ return wake;
1906
+ const narrowed = asked.map(scope => {
1907
+ if (!scope.artifactId || scope.messageId)
1908
+ return undefined;
1909
+ const base = wake.find(w => (w.taskId ?? undefined) === (scope.taskId ?? undefined)
1910
+ && (scope.agreementId ?? w.agreementId) === w.agreementId);
1911
+ return base ? { ...base, artifactId: scope.artifactId } : undefined;
1912
+ });
1913
+ return narrowed.every(Boolean) ? narrowed : wake;
1914
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/agent-sdk",
3
- "version": "0.43.4",
3
+ "version": "0.43.5",
4
4
  "description": "Agent framework SDK for building autonomous agents on the Ziggs platform",
5
5
  "homepage": "https://ziggsai.com/docs",
6
6
  "bugs": {