@ziggs-ai/agent-sdk 0.46.4 → 0.46.6
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 +5 -0
- package/dist/Agent.d.ts +2 -1
- package/dist/Agent.js +31 -13
- package/dist/brain/claudeCognition.js +3 -1
- package/dist/brain/claudeSdkProtocol.js +1 -1
- package/dist/brain/claudeSdkTools.js +8 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.46.5
|
|
6
|
+
|
|
7
|
+
- Every hosted Claude agent has `bucket_create` and `bucket_send`, loaded with their schemas, and its instructions say a new conversation starts in a bucket made on purpose. Handing in `BUCKET_TOOLS` as well no longer warns that they shadow the platform's.
|
|
8
|
+
- The bucket block in a wake names the agreements the work in the bucket is under, and who is waiting to join when their hire starts.
|
|
9
|
+
|
|
5
10
|
## 0.46.4
|
|
6
11
|
|
|
7
12
|
- `ARTIFACT_TOOLS` no longer includes `artifact_share`, and skill agents are no longer offered it: an artifact reaches people only by being added to a bucket. What an agent makes while working in a bucket lands in that bucket on its own.
|
package/dist/Agent.d.ts
CHANGED
|
@@ -295,7 +295,8 @@ export declare class Agent {
|
|
|
295
295
|
private readonly wakeDestination;
|
|
296
296
|
private readonly outboundMessages;
|
|
297
297
|
private readonly confirmedPlanVersions;
|
|
298
|
-
|
|
298
|
+
/** Live connection providers, per execution: what a grant lists depends on the party the wake acts for. */
|
|
299
|
+
private readonly grantProviderCache;
|
|
299
300
|
/** The checkout box each lane holds while its wake runs. */
|
|
300
301
|
private checkoutByLane;
|
|
301
302
|
constructor(options?: AgentOptions);
|
package/dist/Agent.js
CHANGED
|
@@ -142,10 +142,15 @@ function createToolManager(options) {
|
|
|
142
142
|
export function warnOnShadowedPlatformTools(platformTools, ownTools, agentId) {
|
|
143
143
|
if (ownTools.length === 0)
|
|
144
144
|
return;
|
|
145
|
-
const platform = new
|
|
145
|
+
const platform = new Map(platformTools.map((t) => [t.schema.function.name, t]));
|
|
146
|
+
// Handing in the platform's own tool (BUCKET_TOOLS beside the hosted
|
|
147
|
+
// defaults) shadows nothing.
|
|
146
148
|
const shadowed = ownTools
|
|
147
|
-
.
|
|
148
|
-
|
|
149
|
+
.filter((t) => {
|
|
150
|
+
const same = platform.get(t.schema.function.name);
|
|
151
|
+
return same !== undefined && same !== t;
|
|
152
|
+
})
|
|
153
|
+
.map((t) => t.schema.function.name);
|
|
149
154
|
if (shadowed.length === 0)
|
|
150
155
|
return;
|
|
151
156
|
console.warn(`[Agent] ${agentId}: tool name(s) ${shadowed.join(', ')} shadow the platform tools of the same name — ` +
|
|
@@ -244,7 +249,8 @@ export class Agent {
|
|
|
244
249
|
wakeDestination = new AsyncLocalStorage();
|
|
245
250
|
outboundMessages = new SeenMessages();
|
|
246
251
|
confirmedPlanVersions = new SeenMessages();
|
|
247
|
-
|
|
252
|
+
/** Live connection providers, per execution: what a grant lists depends on the party the wake acts for. */
|
|
253
|
+
grantProviderCache = new Map();
|
|
248
254
|
/** The checkout box each lane holds while its wake runs. */
|
|
249
255
|
checkoutByLane = new Map();
|
|
250
256
|
constructor(options = {}) {
|
|
@@ -900,8 +906,12 @@ export class Agent {
|
|
|
900
906
|
return reported !== undefined && reported !== null && reported !== '';
|
|
901
907
|
}
|
|
902
908
|
/** Providers of this agent's live connection grants. Its own seam, so the gate below is testable without a backend. */
|
|
903
|
-
async _listGrantProviders(operatorKey, agentId) {
|
|
904
|
-
|
|
909
|
+
async _listGrantProviders(operatorKey, agentId, execution) {
|
|
910
|
+
// The server answers for the party this call acts for. Without the wake's
|
|
911
|
+
// execution it answers for the agent's own operator, so a grant a customer
|
|
912
|
+
// gave for a hire is never listed and every hired agent reads as unconnected.
|
|
913
|
+
const read = () => new ConnectionsClient(operatorKey, agentId).listForHolder();
|
|
914
|
+
const groups = execution ? await withWorkExecution(execution, read) : await read();
|
|
905
915
|
return groups.filter((g) => (g.grants ?? []).length > 0).map((g) => g.provider);
|
|
906
916
|
}
|
|
907
917
|
/**
|
|
@@ -909,13 +919,18 @@ export class Agent {
|
|
|
909
919
|
* several in seconds — but hire comes before grant, so a grant arriving
|
|
910
920
|
* mid-engagement has to take effect without a restart.
|
|
911
921
|
*/
|
|
912
|
-
async _grantProvidersCached(operatorKey, agentId) {
|
|
922
|
+
async _grantProvidersCached(operatorKey, agentId, execution) {
|
|
913
923
|
const now = Date.now();
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
924
|
+
const key = execution?.contextId ?? '';
|
|
925
|
+
const cached = this.grantProviderCache.get(key);
|
|
926
|
+
if (cached && now - cached.at < 30_000)
|
|
927
|
+
return cached.providers;
|
|
928
|
+
const providers = await this._listGrantProviders(operatorKey, agentId, execution);
|
|
929
|
+
this.grantProviderCache.set(key, { at: now, providers });
|
|
930
|
+
// One entry per live execution is enough; drop the stale ones as they pass.
|
|
931
|
+
for (const [k, v] of this.grantProviderCache)
|
|
932
|
+
if (now - v.at >= 30_000)
|
|
933
|
+
this.grantProviderCache.delete(k);
|
|
919
934
|
return providers;
|
|
920
935
|
}
|
|
921
936
|
/**
|
|
@@ -942,7 +957,10 @@ export class Agent {
|
|
|
942
957
|
return false;
|
|
943
958
|
let providers;
|
|
944
959
|
try {
|
|
945
|
-
|
|
960
|
+
// The grant a customer gave for a hire is listed to the wake that works that hire.
|
|
961
|
+
const execution = this.sessions?.get(_laneKey)?.executionContext ??
|
|
962
|
+
(_event?.executionContext);
|
|
963
|
+
providers = await this._grantProvidersCached(operatorKey, agentId, execution);
|
|
946
964
|
}
|
|
947
965
|
catch (err) {
|
|
948
966
|
// A grants read that failed is not proof the grant is missing, and failing
|
|
@@ -129,7 +129,9 @@ export function bucketBlock(raw) {
|
|
|
129
129
|
if (contents.tasks?.length)
|
|
130
130
|
lines.push(`Tasks: ${contents.tasks.map((t) => `${t.taskId} (${t.title}, ${t.state})`).join(', ')}.`);
|
|
131
131
|
if (contents.agreements?.length)
|
|
132
|
-
lines.push(`Agreements: ${contents.agreements.map((a) => `${a.agreementId} (${a.title}, ${a.status})`).join(', ')}.`);
|
|
132
|
+
lines.push(`Agreements the work here is under: ${contents.agreements.map((a) => `${a.agreementId} (${a.title}, ${a.status})`).join(', ')}.`);
|
|
133
|
+
if (contents.invites?.length)
|
|
134
|
+
lines.push(`Waiting to join when their hire starts: ${contents.invites.map((i) => `${i.waitingFor.join(', ') || 'whoever claims it'} (${i.agreementId})`).join('; ')}.`);
|
|
133
135
|
if (threads.length > 1 || contents.artifacts?.length || contents.tasks?.length || contents.agreements?.length)
|
|
134
136
|
lines.push('Read a thread with message_list conversationOf=<thread>; an artifact with context_read type=artifacts via=artifact:<id>.');
|
|
135
137
|
if (contents.outOfReach > 0)
|
|
@@ -18,7 +18,7 @@ Each wake hands you ONE event (or a small batch). Read workBrief for current wor
|
|
|
18
18
|
|
|
19
19
|
Ziggs tools loaded with their full schemas are ${loadedByName}, plus any tools that belong to you specifically. Every other Ziggs tool exists too and is called by its own name; its schema loads when you look it up with ToolSearch, by name or by what you need done. When the lines below name \`context_snapshot\`, \`wake_at\`, \`task_list\`, \`task_update_plan_step\`, \`grant_list\`, or an agreement verb, look it up that way and call it.
|
|
20
20
|
|
|
21
|
-
Your prose and final summary are private host notes, not messages to the people or agents you work with. To reply, use the reply action in workBrief: it sends your text, and the host links it to the message that woke you and delivers it to that message's readers and sender. All private, group and work communication uses \`message_send\` with one \`command\`: stable operationId, content:{text}, audience:{kind:"explicit",principalIds:[...]}, deliveries:{kind:"explicit",principalIds:[...]}, and intent. Every message carries one flag: intent:"request" wakes the agents it is delivered to; intent:"fyi" is delivered and filed and never wakes anyone. You are woken only for requests; an fyi reaches your inbox without waking you. Flag your own message a request only when you need the other side's agent to act on it; a reply to a person is an fyi. Nothing records whether a request was answered: a reply is a message whose relationships.replyToMessageId names what it answers. Keep an explicitly selected mandate:{agreementId,taskId?}. Reuse the exact command after an uncertain response. Never treat a 409 as success. Reading the question and writing the answer in your final summary does not deliver it: send it.
|
|
21
|
+
Your prose and final summary are private host notes, not messages to the people or agents you work with. To reply, use the reply action in workBrief: it sends your text, and the host links it to the message that woke you and delivers it to that message's readers and sender. All private, group and work communication uses \`message_send\` with one \`command\`: stable operationId, content:{text}, audience:{kind:"explicit",principalIds:[...]}, deliveries:{kind:"explicit",principalIds:[...]}, and intent. Every message carries one flag: intent:"request" wakes the agents it is delivered to; intent:"fyi" is delivered and filed and never wakes anyone. You are woken only for requests; an fyi reaches your inbox without waking you. Flag your own message a request only when you need the other side's agent to act on it; a reply to a person is an fyi. Nothing records whether a request was answered: a reply is a message whose relationships.replyToMessageId names what it answers. Keep an explicitly selected mandate:{agreementId,taskId?}. Reuse the exact command after an uncertain response. Never treat a 409 as success. Reading the question and writing the answer in your final summary does not deliver it: send it. A reply, and a message about the work you were woken for, go into its bucket on their own. A new conversation with people you are not already talking with starts in a bucket made on purpose: \`bucket_create\` with its name and the people it is for, then \`bucket_send\` inside it, which names only who is told, since everyone in a bucket reads it.
|
|
22
22
|
|
|
23
23
|
- The event identifies the assigned action. Use \`context_snapshot\` with its exact message, task, agreement or artifact reference. Readers, delivery recipients and the agents a request wakes are separate. An fyi creates no obligation; a message linked to a task (relationships.taskIds or a task mandate) is that task's input and advances it. Use \`message_replies\` for authorized causal replies; history does not come from inbox receipts.
|
|
24
24
|
- For factual answers, read relevant source artifacts before concluding information is missing. The snapshot's artifact list is a bounded inventory, not document contents; use \`context_read\` on the room's artifacts and follow pagination, or search artifacts when that tool is available. An empty direct \`grant_list\` is not evidence that room documents are unavailable. Report dated information with its date and distinguish it from a fresh confirmation. Check shared sources before repeating another agent's unsupported "no data" conclusion.
|
|
@@ -4,6 +4,7 @@ import { toolsFromCapabilities } from '../tools/capabilityAdapter.js';
|
|
|
4
4
|
import { defineTool } from '../tools/defineTool.js';
|
|
5
5
|
import { listGrantsTool } from '../platform/tools/tier2/grantsTools.js';
|
|
6
6
|
import { cancelTaskTool, listTasksTool, delegateTaskTool } from '../platform/tools/tier2/taskTools.js';
|
|
7
|
+
import { BUCKET_TOOLS } from '../platform/tools/tier2/bucketTools.js';
|
|
7
8
|
// Optional message history stays bounded; deeper history is an explicit read.
|
|
8
9
|
const DEFAULT_SNAPSHOT_MAX_MESSAGES = 12;
|
|
9
10
|
/** Blank selectors do not replace the current wake's exact resource scope. */
|
|
@@ -75,6 +76,12 @@ export const messageSendTool = defineTool('message_send', { command: { type: 'ob
|
|
|
75
76
|
// Claude surface previously had no way to enumerate its own open tasks (reads
|
|
76
77
|
// were prompt-injected only). Same GET /tasks capability as the MCP tool.
|
|
77
78
|
export { listTasksTool, cancelTaskTool, delegateTaskTool };
|
|
79
|
+
/**
|
|
80
|
+
* A new conversation starts in a bucket made on purpose: the agent creates one
|
|
81
|
+
* with the people it is for and sends inside it. Every hosted agent has these
|
|
82
|
+
* two, the same tool objects `BUCKET_TOOLS` hands out.
|
|
83
|
+
*/
|
|
84
|
+
const BUCKET_DEFAULTS = BUCKET_TOOLS.filter((tool) => ['bucket_create', 'bucket_send'].includes(String(tool.schema.function.name)));
|
|
78
85
|
export const CLAUDE_SDK_TOOLS = [
|
|
79
86
|
contextSnapshotTool,
|
|
80
87
|
messageSendTool,
|
|
@@ -83,4 +90,5 @@ export const CLAUDE_SDK_TOOLS = [
|
|
|
83
90
|
cancelTaskTool,
|
|
84
91
|
delegateTaskTool,
|
|
85
92
|
...toolsFromCapabilities(MESSAGING_CAPABILITIES),
|
|
93
|
+
...BUCKET_DEFAULTS,
|
|
86
94
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ziggs-ai/agent-sdk",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.6",
|
|
4
4
|
"description": "Agent framework SDK for building autonomous agents on the Ziggs platform",
|
|
5
5
|
"homepage": "https://ziggsai.com/docs",
|
|
6
6
|
"bugs": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@anthropic-ai/claude-agent-sdk": "^0.3.284",
|
|
31
31
|
"@anthropic-ai/sdk": "^0.110.0",
|
|
32
32
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
33
|
-
"@ziggs-ai/api-client": "0.40.
|
|
34
|
-
"@ziggs-ai/contracts": "0.48.
|
|
33
|
+
"@ziggs-ai/api-client": "0.40.7",
|
|
34
|
+
"@ziggs-ai/contracts": "0.48.1",
|
|
35
35
|
"ajv": "^8.17.1",
|
|
36
36
|
"dotenv": "^17.2.3",
|
|
37
37
|
"openai": "^4.0.0",
|