@ziggs-ai/agent-sdk 0.46.8 → 0.47.0
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/README.md +1 -1
- package/dist/Agent.d.ts +5 -7
- package/dist/Agent.js +29 -60
- package/dist/brain/ClaudeBrain.d.ts +3 -3
- package/dist/brain/ClaudeBrain.js +4 -5
- package/dist/brain/claudeCognition.js +2 -2
- package/dist/brain/claudeSdkProtocol.js +5 -5
- package/dist/brain/claudeSdkTools.d.ts +0 -1
- package/dist/brain/claudeSdkTools.js +1 -1
- package/dist/brain/wakeGate.d.ts +0 -3
- package/dist/brain/wakeGate.js +0 -6
- package/dist/ingress/normalizeIncoming.d.ts +0 -2
- package/dist/ingress/normalizeIncoming.js +0 -9
- package/dist/mcp/createMcpAgent.js +2 -2
- package/dist/memory/MemoryStore.d.ts +5 -5
- package/dist/memory/MemoryStore.js +4 -4
- package/dist/platform/OutboxBuffer.d.ts +2 -2
- package/dist/platform/OutboxBuffer.js +17 -17
- package/dist/platform/WakeLedger.d.ts +0 -2
- package/dist/platform/WakeLedger.js +0 -1
- package/dist/platform/ZiggsEffectHandler.d.ts +0 -1
- package/dist/platform/ZiggsEffectHandler.js +8 -12
- package/dist/platform/inboxLoop.js +1 -2
- package/dist/platform/polls/PollKind.d.ts +2 -2
- package/dist/platform/polls/PollKind.js +1 -1
- package/dist/platform/telemetryIngest.js +1 -4
- package/dist/platform/tools/tier1/protocolRunner.d.ts +3 -1
- package/dist/platform/tools/tier1/protocolRunner.js +10 -23
- package/dist/platform/tools/tier1/protocolTools.js +2 -2
- package/dist/platform/tools/tier1/wakeTools.d.ts +0 -1
- package/dist/platform/tools/tier2/listingTools.js +1 -1
- package/dist/platform/tools/tier2/mcpConnectionTools.js +1 -1
- package/dist/platform/tools/tier2/partyTools.js +2 -2
- package/dist/platform/tools/tier2/planTools.d.ts +2 -2
- package/dist/platform/tools/tier2/planTools.js +3 -3
- package/dist/runtime/AgentMachine.d.ts +1 -1
- package/dist/runtime/AgentMachine.js +1 -1
- package/dist/runtime/PromptBuilder.d.ts +1 -1
- package/dist/runtime/PromptBuilder.js +7 -9
- package/dist/runtime/agreementContext.d.ts +4 -4
- package/dist/runtime/agreementContext.js +4 -4
- package/dist/runtime/buildOutcome.d.ts +0 -1
- package/dist/runtime/deliveryWriteKeys.d.ts +1 -2
- package/dist/runtime/deliveryWriteKeys.js +1 -2
- package/dist/runtime/kickoff.d.ts +2 -2
- package/dist/runtime/kickoff.js +2 -2
- package/dist/runtime/messageCommand.d.ts +1 -1
- package/dist/runtime/messageCommand.js +1 -1
- package/dist/runtime/runTurn.js +5 -18
- package/dist/runtime/wakeEffects.d.ts +1 -1
- package/dist/runtime/wakeEffects.js +1 -1
- package/dist/runtime/wakeOutcome.js +0 -1
- package/dist/tools/recordReport.d.ts +3 -5
- package/dist/tools/recordReport.js +4 -11
- package/dist/tools/toolCreds.d.ts +4 -4
- package/dist/tools/toolCreds.js +5 -7
- package/dist/types.d.ts +7 -9
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- An agent keeps no conversation of its own. The default session resolver lanes a message by its agreement, then its bucket, then the message itself; `NormalizedEvent` drops `addressId`. A wake's destination, a saved wake, telemetry, the wake gate request, `recordReport` and the tool context no longer carry `addressId`, and a tool's lane comes only from `sessionId`. Tool operation records are written only for a wake with work (an agreement or a task).
|
|
6
|
+
- Proposals and sub-agreements from the protocol tools name no conversation. `dispatchProtocolOp` keeps its third argument for call compatibility and sends nothing from it.
|
|
7
|
+
- The inbox marks the messages it hands over with `fromInbox`; a session keeps that message's agreement as `messageAgreementId`.
|
|
8
|
+
- The hosted protocol, the FSM prompt and tool descriptions say conversation, bucket or work where they said room.
|
|
9
|
+
|
|
5
10
|
## 0.46.5
|
|
6
11
|
|
|
7
12
|
- 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.
|
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ who want them.
|
|
|
150
150
|
|
|
151
151
|
## External wake sources
|
|
152
152
|
|
|
153
|
-
Declare `polls: [{ kind,
|
|
153
|
+
Declare `polls: [{ kind, ...sourceOptions }]` and their implementations in
|
|
154
154
|
`pollKinds`. Each implementation supplies an `id`, optional `intervalMs` and
|
|
155
155
|
`poll(binding, { agentId, operatorKey })`, returning `{ actionable, hint? }`.
|
|
156
156
|
|
package/dist/Agent.d.ts
CHANGED
|
@@ -36,20 +36,18 @@ import type { CheckoutProvider } from './checkout/types.js';
|
|
|
36
36
|
/**
|
|
37
37
|
* Given a normalized event, return the sessionId for this agent. Return
|
|
38
38
|
* `null` to skip processing. Lets each Agent define what "session" means —
|
|
39
|
-
* the default groups by
|
|
39
|
+
* the default groups by agreement, then bucket, then the exact message; task-scoped agents
|
|
40
40
|
* could bucket by taskId, cron agents by schedule id, etc.
|
|
41
41
|
*/
|
|
42
42
|
export type SessionResolver = (normalized: NormalizedEvent, ownAgentId: string) => string | null;
|
|
43
43
|
/**
|
|
44
44
|
* one lane key per unit of work, derived the same way as inbox wakes.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
* prefer bare `agreementId`, which opened a second lane for the same task and
|
|
46
|
+
* Bootstrap used to prefer bare `agreementId`, which opened a second lane for the same task and
|
|
48
47
|
* misdirected the snapshot read. Use the agreement's local processing key. An origin link is
|
|
49
48
|
* navigation, not a delivery destination. This key creates no chat or grant.
|
|
50
49
|
*/
|
|
51
50
|
export declare function laneSessionIdForTask(task: {
|
|
52
|
-
originChatId?: string | null;
|
|
53
51
|
agreementId?: string | null;
|
|
54
52
|
}): string;
|
|
55
53
|
interface LlmAdapter {
|
|
@@ -134,7 +132,7 @@ export interface AgentOptions {
|
|
|
134
132
|
states?: Workflow['states'];
|
|
135
133
|
initial?: string;
|
|
136
134
|
tickTimeoutMs?: number;
|
|
137
|
-
/** Per-agent session keying. Defaults to
|
|
135
|
+
/** Per-agent session keying. Defaults to the agreement, bucket or message lane. */
|
|
138
136
|
sessionResolver?: SessionResolver;
|
|
139
137
|
/**
|
|
140
138
|
* Agent-private long-term memory. With an operator key and agent id, the
|
|
@@ -289,7 +287,7 @@ export declare class Agent {
|
|
|
289
287
|
private unmetTasksPendingAsk;
|
|
290
288
|
private readonly wakeEffects;
|
|
291
289
|
/**
|
|
292
|
-
* The
|
|
290
|
+
* The destination a live wake runs with. A tool's send or read reaches the
|
|
293
291
|
* host without the wake's effect wrapper, so both look the lane up here.
|
|
294
292
|
*/
|
|
295
293
|
private readonly wakeDestination;
|
|
@@ -367,7 +365,7 @@ export declare class Agent {
|
|
|
367
365
|
/**
|
|
368
366
|
* A chat-lane session that still carries a cancelled hire from a previous
|
|
369
367
|
* engagement will agreement_get that dead row and stop. Drop it so this
|
|
370
|
-
* wake keys on the live
|
|
368
|
+
* wake keys on the live hire.
|
|
371
369
|
*/
|
|
372
370
|
private dropStaleCancelledAgreementSession;
|
|
373
371
|
private agreementIsTerminal;
|
package/dist/Agent.js
CHANGED
|
@@ -56,15 +56,13 @@ async function loadConnectionPool() {
|
|
|
56
56
|
const mod = await import(/* @vite-ignore */ modPath);
|
|
57
57
|
return mod.ConnectionPool;
|
|
58
58
|
}
|
|
59
|
-
const DEFAULT_SESSION_RESOLVER = (normalized) => normalized.
|
|
60
|
-
|
|
61
|
-
: normalized.event.
|
|
62
|
-
: normalized.event.messageId ? `msgn-${normalized.event.messageId}` : null);
|
|
59
|
+
const DEFAULT_SESSION_RESOLVER = (normalized) => normalized.event.agreementId ? `agrn-${normalized.event.agreementId}`
|
|
60
|
+
: normalized.event.bucket ? `bkt-${normalized.event.bucket.bucketId}`
|
|
61
|
+
: normalized.event.messageId ? `msgn-${normalized.event.messageId}` : null;
|
|
63
62
|
/**
|
|
64
63
|
* one lane key per unit of work, derived the same way as inbox wakes.
|
|
65
64
|
*
|
|
66
|
-
*
|
|
67
|
-
* prefer bare `agreementId`, which opened a second lane for the same task and
|
|
65
|
+
* Bootstrap used to prefer bare `agreementId`, which opened a second lane for the same task and
|
|
68
66
|
* misdirected the snapshot read. Use the agreement's local processing key. An origin link is
|
|
69
67
|
* navigation, not a delivery destination. This key creates no chat or grant.
|
|
70
68
|
*/
|
|
@@ -243,7 +241,7 @@ export class Agent {
|
|
|
243
241
|
unmetTasksPendingAsk = new Map();
|
|
244
242
|
wakeEffects = new AsyncLocalStorage();
|
|
245
243
|
/**
|
|
246
|
-
* The
|
|
244
|
+
* The destination a live wake runs with. A tool's send or read reaches the
|
|
247
245
|
* host without the wake's effect wrapper, so both look the lane up here.
|
|
248
246
|
*/
|
|
249
247
|
wakeDestination = new AsyncLocalStorage();
|
|
@@ -603,17 +601,15 @@ export class Agent {
|
|
|
603
601
|
}
|
|
604
602
|
}
|
|
605
603
|
// Map the event to a candidate session key using the configured resolver
|
|
606
|
-
// on a synthetic normalized-event shape.
|
|
607
|
-
//
|
|
608
|
-
//
|
|
609
|
-
// event carries the corresponding id.
|
|
604
|
+
// on a synthetic normalized-event shape. Agents using a different
|
|
605
|
+
// sessionResolver (agreementId, taskId, counterpartyId) will get the right
|
|
606
|
+
// lane here as long as the wire event carries the corresponding id.
|
|
610
607
|
const fakeNormalized = {
|
|
611
|
-
addressId: event.addressId,
|
|
612
608
|
event: { type: 'message', timestamp: Date.now(), text: '' },
|
|
613
609
|
};
|
|
614
610
|
let sessionId = this.sessionResolver(fakeNormalized, ownAgentId);
|
|
615
|
-
//
|
|
616
|
-
// drop them; lane by agreement the same way task bootstrap does
|
|
611
|
+
// Resource events carry no message, so the resolver usually has nothing
|
|
612
|
+
// to go on. Do not drop them; lane by agreement the same way task bootstrap does
|
|
617
613
|
// (`agrn-<agreementId>`), never a bare agreement id.
|
|
618
614
|
if (!sessionId) {
|
|
619
615
|
const agreementId = (typeof event.agreementId === 'string' && event.agreementId) ||
|
|
@@ -640,7 +636,6 @@ export class Agent {
|
|
|
640
636
|
return this.eventQueue.enqueue({
|
|
641
637
|
type: SERVER_EVENTS.resourceChanged,
|
|
642
638
|
resource: event,
|
|
643
|
-
addressId: event.addressId,
|
|
644
639
|
taskId: event.taskId,
|
|
645
640
|
agreementId,
|
|
646
641
|
// Claimer/buyer — the canonical reply command explicitly names the requester.
|
|
@@ -664,20 +659,20 @@ export class Agent {
|
|
|
664
659
|
}
|
|
665
660
|
if (messageId)
|
|
666
661
|
this.seenMessages.mark(messageId);
|
|
667
|
-
// The inbox marks
|
|
662
|
+
// The inbox marks the messages it pulled. They have no other way back to
|
|
668
663
|
// the agent, so one that cannot be routed here stays pending, never dropped.
|
|
669
|
-
const
|
|
670
|
-
const
|
|
664
|
+
const fromInbox = metadata.fromInbox === true;
|
|
665
|
+
const messageAgreementId = fromInbox
|
|
671
666
|
&& typeof metadata.agreementId === 'string' && metadata.agreementId ? metadata.agreementId : undefined;
|
|
672
667
|
const unroutable = (why) => {
|
|
673
668
|
if (messageId)
|
|
674
669
|
this.seenMessages.unmark(messageId);
|
|
675
|
-
return new Error(`handleMessage: message ${messageId ?? '(no id)'} ${
|
|
670
|
+
return new Error(`handleMessage: message ${messageId ?? '(no id)'} ${messageAgreementId ? `under agreement ${messageAgreementId}` : 'with an exact action'} ${why}. Left pending.`);
|
|
676
671
|
};
|
|
677
672
|
const ownAgentId = this._resolveOwnAgentId();
|
|
678
673
|
if (!ownAgentId) {
|
|
679
|
-
if (
|
|
680
|
-
throw unroutable('ownAgentId is missing');
|
|
674
|
+
if (fromInbox)
|
|
675
|
+
throw unroutable('cannot run: ownAgentId is missing');
|
|
681
676
|
runtimeLog.warn('Agent', 'handleMessage: ownAgentId missing — dropping event');
|
|
682
677
|
return;
|
|
683
678
|
}
|
|
@@ -698,9 +693,9 @@ export class Agent {
|
|
|
698
693
|
const normalized = normalizeIncomingEvent({ text: enrichedText, metadata, ownAgentId });
|
|
699
694
|
const sessionId = this.sessionResolver(normalized, ownAgentId);
|
|
700
695
|
if (!sessionId) {
|
|
701
|
-
if (
|
|
702
|
-
throw unroutable('the session resolver returned
|
|
703
|
-
runtimeLog.warn('Agent', `session resolver returned null ownAgentId=${ownAgentId}
|
|
696
|
+
if (fromInbox)
|
|
697
|
+
throw unroutable('has no lane: the session resolver returned none');
|
|
698
|
+
runtimeLog.warn('Agent', `session resolver returned null ownAgentId=${ownAgentId} messageId=${messageId ?? 'null'}`);
|
|
704
699
|
return;
|
|
705
700
|
}
|
|
706
701
|
const executionContext = metadata.executionContext;
|
|
@@ -713,8 +708,8 @@ export class Agent {
|
|
|
713
708
|
}
|
|
714
709
|
if (bucket && bucketLaneId(executionContext ?? currentWorkExecution(), bucket))
|
|
715
710
|
this.sessions.get(laneKey).bucket = bucket;
|
|
716
|
-
if (
|
|
717
|
-
this.sessions.get(laneKey).
|
|
711
|
+
if (messageAgreementId)
|
|
712
|
+
this.sessions.get(laneKey).messageAgreementId = messageAgreementId;
|
|
718
713
|
// The inbox loop owns ack (act-before-ack, delivery law); the agent only
|
|
719
714
|
// routes the event onto its lane. No live-path watermark ack — there is no
|
|
720
715
|
// separate live/push channel to reconcile against anymore.
|
|
@@ -723,7 +718,7 @@ export class Agent {
|
|
|
723
718
|
// the same message being processed twice; leaving it set on a failed wake
|
|
724
719
|
// would make the redelivery this rejection buys us a no-op.
|
|
725
720
|
try {
|
|
726
|
-
await this.eventQueue.enqueue(
|
|
721
|
+
await this.eventQueue.enqueue(normalized.event, laneKey, executionContext);
|
|
727
722
|
}
|
|
728
723
|
catch (err) {
|
|
729
724
|
if (messageId)
|
|
@@ -808,7 +803,7 @@ export class Agent {
|
|
|
808
803
|
/**
|
|
809
804
|
* A chat-lane session that still carries a cancelled hire from a previous
|
|
810
805
|
* engagement will agreement_get that dead row and stop. Drop it so this
|
|
811
|
-
* wake keys on the live
|
|
806
|
+
* wake keys on the live hire.
|
|
812
807
|
*/
|
|
813
808
|
async dropStaleCancelledAgreementSession(session) {
|
|
814
809
|
const ctx = session.ctx;
|
|
@@ -1077,45 +1072,24 @@ export class Agent {
|
|
|
1077
1072
|
const execution = session.executionContext;
|
|
1078
1073
|
const wake = asFrame(frame);
|
|
1079
1074
|
const events = wake.type === 'batch' && Array.isArray(wake.events) ? wake.events.map(asFrame) : undefined;
|
|
1080
|
-
// The shared conversations this wake's own messages arrived in.
|
|
1081
|
-
const rooms = [...new Set((events ?? [wake]).filter(e => e.type === 'message').map(e => text(e.addressId)).filter((id) => !!id))];
|
|
1082
|
-
const room = rooms.length === 1 ? rooms[0] : undefined;
|
|
1083
1075
|
// A direct execution exists to answer one exact message.
|
|
1084
1076
|
const actionMessageId = execution && !execution.agreementId && execution.action?.kind === 'message' ? text(execution.action.id) : undefined;
|
|
1085
|
-
// Agreement work answers in its own conversation; only a lane without work
|
|
1086
|
-
// execution, or a direct execution, keeps the room its messages came from.
|
|
1087
|
-
const remembers = !execution || !!actionMessageId;
|
|
1088
|
-
if (remembers && rooms.length)
|
|
1089
|
-
session.addressId = room && (session.addressId === undefined || session.addressId === room) ? room : null;
|
|
1090
|
-
const remembered = remembers ? session.addressId ?? undefined : undefined;
|
|
1091
1077
|
const explicitAgreement = text(wake.agreementId) ?? text(wake.resource?.agreementId) ?? text(wake.result?.agreementId)
|
|
1092
1078
|
?? (events ? marks.scope.agreementId : undefined);
|
|
1093
|
-
const explicitChat = text(wake.addressId) ?? text(wake.resource?.addressId);
|
|
1094
|
-
// An exact incoming message supplies its reply address, and a batch of
|
|
1095
|
-
// messages from one room keeps that room; from several rooms the agent
|
|
1096
|
-
// names one. Work execution supplies authority, never a transport
|
|
1097
|
-
// default: under it, other events' navigation hints select no chat.
|
|
1098
|
-
const addressId = wake.type === 'message' ? explicitChat
|
|
1099
|
-
: events ? room ?? (rooms.length ? undefined : remembered)
|
|
1100
|
-
: execution ? remembered
|
|
1101
|
-
: explicitChat ?? remembered;
|
|
1102
1079
|
// An unscoped batch cannot borrow a previous customer's agreement.
|
|
1103
1080
|
const agreementId = execution ? execution.agreementId ?? undefined
|
|
1104
|
-
: explicitAgreement ?? (events ? undefined : session.
|
|
1081
|
+
: explicitAgreement ?? (events ? undefined : session.messageAgreementId);
|
|
1105
1082
|
const message = wake.type === 'message' && text(wake.messageId)
|
|
1106
1083
|
? { messageId: wake.messageId, ...(text(wake.senderId) ? { senderId: wake.senderId } : {}), ...(text(wake.taskId) ? { taskId: wake.taskId } : {}) }
|
|
1107
1084
|
: actionMessageId ? { messageId: actionMessageId } : undefined;
|
|
1108
|
-
|
|
1109
|
-
if (!agreementId && !addressId && !message && !inputRooms)
|
|
1085
|
+
if (!agreementId && !message)
|
|
1110
1086
|
return undefined;
|
|
1111
1087
|
const taskId = execution ? execution.taskId ?? undefined : marks.scope.taskId;
|
|
1112
1088
|
return {
|
|
1113
1089
|
sessionId: session.sessionId,
|
|
1114
1090
|
agreementId,
|
|
1115
|
-
addressId,
|
|
1116
1091
|
...(message ? { message } : {}),
|
|
1117
1092
|
...(taskId ? { taskId } : {}),
|
|
1118
|
-
...(inputRooms ? { inputRooms } : {}),
|
|
1119
1093
|
};
|
|
1120
1094
|
}
|
|
1121
1095
|
async _processEvent(event, laneKey, execution) {
|
|
@@ -1137,7 +1111,7 @@ export class Agent {
|
|
|
1137
1111
|
return;
|
|
1138
1112
|
if (session.executionContext)
|
|
1139
1113
|
await validateWorkExecution(currentWorkExecution() ?? session.executionContext, this.options.operatorKey, resolveBackendUrl());
|
|
1140
|
-
// Presentation may call our sender
|
|
1114
|
+
// Presentation may call our sender by a persona or by the person we
|
|
1141
1115
|
// stand in for. Only an exact canonical messageId we successfully sent proves
|
|
1142
1116
|
// an echo; another message from the same binding still gets a full wake.
|
|
1143
1117
|
const incoming = event;
|
|
@@ -1382,8 +1356,8 @@ export class Agent {
|
|
|
1382
1356
|
};
|
|
1383
1357
|
try {
|
|
1384
1358
|
await checkpoint();
|
|
1385
|
-
const
|
|
1386
|
-
const tick = () => this.wakeDestination.run(
|
|
1359
|
+
const destination = this.wakeDestinationFor(session, frame, marks);
|
|
1360
|
+
const tick = () => this.wakeDestination.run(destination, () => this.wakeEffects.run(marks, () => this.brain.tick({ event: frame, ctx: session.ctx, state: session.state, identity, eff, memory, transitionTap: this.options.transitionTap, signal: tickAbort.signal, ...(checkout ? { checkout: checkout.session } : {}) })));
|
|
1387
1361
|
tickWork = executionController ? executionControllers.run(executionController, tick) : tick();
|
|
1388
1362
|
const result = await Promise.race([
|
|
1389
1363
|
tickWork,
|
|
@@ -1797,9 +1771,6 @@ export class Agent {
|
|
|
1797
1771
|
const laneKey = laneKeyFor(this.options.agentId, sessionId);
|
|
1798
1772
|
const scope = this.wakeEffects.getStore()?.scope;
|
|
1799
1773
|
const armed = this.stateTimers.armWakeAt(laneKey, at, reason, scope);
|
|
1800
|
-
// The conversation the lane's messages came from, so a restarted host
|
|
1801
|
-
// answers there too instead of reading the lane name as an address.
|
|
1802
|
-
const addressId = this.sessions.get(laneKey)?.addressId;
|
|
1803
1774
|
const bucket = this.sessions.get(laneKey)?.bucket;
|
|
1804
1775
|
this.wakeLedger.arm({
|
|
1805
1776
|
laneKey,
|
|
@@ -1808,7 +1779,6 @@ export class Agent {
|
|
|
1808
1779
|
wakeId: armed.wakeId,
|
|
1809
1780
|
reason,
|
|
1810
1781
|
...(scope ? { scope } : {}),
|
|
1811
|
-
...(addressId ? { addressId } : {}),
|
|
1812
1782
|
...(bucket ? { bucket } : {}),
|
|
1813
1783
|
executionContext: currentWorkExecution() ? { ...currentWorkExecution(), attemptId: undefined } : undefined,
|
|
1814
1784
|
});
|
|
@@ -1840,8 +1810,7 @@ export class Agent {
|
|
|
1840
1810
|
if (!this.sessions.has(wake.laneKey)) {
|
|
1841
1811
|
const onBucketLane = bucketLaneId(wake.executionContext, wake.bucket);
|
|
1842
1812
|
this.sessions.set(wake.laneKey, { sessionId: wake.sessionId, ownAgentId: agentId, executionContext: wake.executionContext,
|
|
1843
|
-
...(onBucketLane && wake.bucket ? { bucket: wake.bucket } : {})
|
|
1844
|
-
...(wake.addressId ? { addressId: wake.addressId } : {}) });
|
|
1813
|
+
...(onBucketLane && wake.bucket ? { bucket: wake.bucket } : {}) });
|
|
1845
1814
|
}
|
|
1846
1815
|
try {
|
|
1847
1816
|
this.stateTimers.armWakeAt(wake.laneKey, wake.firesAt, wake.reason, wake.scope, wake.wakeId);
|
|
@@ -82,7 +82,7 @@ export declare function isMissingSessionError(err: unknown): boolean;
|
|
|
82
82
|
/**
|
|
83
83
|
* The agreement every delivery in this wake is under, or undefined when none
|
|
84
84
|
* names one or they disagree. A batch across agreements names nothing, and the
|
|
85
|
-
* backend holds that wake to its
|
|
85
|
+
* backend holds that wake to its own message.
|
|
86
86
|
*/
|
|
87
87
|
export declare function wakeAgreementOf(event: RawEvent | undefined): string | undefined;
|
|
88
88
|
export declare class ClaudeBrain implements Brain {
|
|
@@ -102,9 +102,9 @@ export declare class ClaudeBrain implements Brain {
|
|
|
102
102
|
private readAgreement;
|
|
103
103
|
private askWakeGate;
|
|
104
104
|
/**
|
|
105
|
-
* Per-lane tool context. One agent object serves every
|
|
105
|
+
* Per-lane tool context. One agent object serves every lane, and a
|
|
106
106
|
* wake's query can still be running when another lane starts. A single
|
|
107
|
-
* `current` field meant B's
|
|
107
|
+
* `current` field meant B's lane/sender/write keys overwrote A's
|
|
108
108
|
* mid-query. Wakes on one lane stay serialized; one server per lane is
|
|
109
109
|
* enough, and getContext closes over that lane's key.
|
|
110
110
|
*/
|
|
@@ -15,7 +15,7 @@ import { assertHostedAgentZiggsTools } from './hostedAgentConnection.js';
|
|
|
15
15
|
import { runtimeLog } from '../shared/runtimeLog.js';
|
|
16
16
|
import { resolveOnBehalfAgreementId, } from './onBehalfAgreement.js';
|
|
17
17
|
import { filterStandingOfferNotices } from './standingOfferNotice.js';
|
|
18
|
-
import { gateableMessages,
|
|
18
|
+
import { gateableMessages, wakeAgreementId } from './wakeGate.js';
|
|
19
19
|
/**
|
|
20
20
|
* status notices must not spend a Claude turn answering
|
|
21
21
|
* nobody. Real work wakes arrive as chat `message`, synthetic `task_result`
|
|
@@ -178,7 +178,7 @@ function extractMetrics(message) {
|
|
|
178
178
|
/**
|
|
179
179
|
* The agreement every delivery in this wake is under, or undefined when none
|
|
180
180
|
* names one or they disagree. A batch across agreements names nothing, and the
|
|
181
|
-
* backend holds that wake to its
|
|
181
|
+
* backend holds that wake to its own message.
|
|
182
182
|
*/
|
|
183
183
|
export function wakeAgreementOf(event) {
|
|
184
184
|
if (!event)
|
|
@@ -209,9 +209,9 @@ export class ClaudeBrain {
|
|
|
209
209
|
readAgreement;
|
|
210
210
|
askWakeGate;
|
|
211
211
|
/**
|
|
212
|
-
* Per-lane tool context. One agent object serves every
|
|
212
|
+
* Per-lane tool context. One agent object serves every lane, and a
|
|
213
213
|
* wake's query can still be running when another lane starts. A single
|
|
214
|
-
* `current` field meant B's
|
|
214
|
+
* `current` field meant B's lane/sender/write keys overwrote A's
|
|
215
215
|
* mid-query. Wakes on one lane stay serialized; one server per lane is
|
|
216
216
|
* enough, and getContext closes over that lane's key.
|
|
217
217
|
*/
|
|
@@ -304,7 +304,6 @@ export class ClaudeBrain {
|
|
|
304
304
|
if (gateMessages && this.askWakeGate) {
|
|
305
305
|
const gate = await this.askWakeGate({
|
|
306
306
|
messages: gateMessages,
|
|
307
|
-
...(wakeAddressId(rawEvent) ? { addressId: wakeAddressId(rawEvent) } : {}),
|
|
308
307
|
...(wakeAgreementId(rawEvent) ? { agreementId: wakeAgreementId(rawEvent) } : {}),
|
|
309
308
|
});
|
|
310
309
|
if (gate && gate.wake === false) {
|
|
@@ -138,7 +138,7 @@ export function bucketBlock(raw) {
|
|
|
138
138
|
lines.push(`${contents.outOfReach} more item(s) here are out of this run's reach.`);
|
|
139
139
|
return lines.join('\n');
|
|
140
140
|
}
|
|
141
|
-
/** Ids and names only. Absent when the wake has nothing outside the
|
|
141
|
+
/** Ids and names only. Absent when the wake has nothing outside the work's inventory. */
|
|
142
142
|
function directArtifactGrantLine(snap) {
|
|
143
143
|
const granted = snap.grantedArtifacts;
|
|
144
144
|
if (!granted || typeof granted !== 'object')
|
|
@@ -159,7 +159,7 @@ function directArtifactGrantLine(snap) {
|
|
|
159
159
|
return '';
|
|
160
160
|
const omitted = granted.omitted;
|
|
161
161
|
const more = typeof omitted === 'number' && omitted > 0 ? ` ${omitted} more on grant_list.` : '';
|
|
162
|
-
return `\nReadable artifacts
|
|
162
|
+
return `\nReadable artifacts outside this work: ${names.join(', ')}.${more} Bodies are not here; read one with context_read type=artifacts via=artifact:<id>.`;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
165
|
* How a held task's deadline and reminder rule read in the prompt.
|
|
@@ -21,14 +21,14 @@ Ziggs tools loaded with their full schemas are ${loadedByName}, plus any tools t
|
|
|
21
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
|
-
- 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
|
|
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 work's artifacts and follow pagination, or search artifacts when that tool is available. An empty direct \`grant_list\` is not evidence that the work's 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.
|
|
25
25
|
- Work is a task under an agreement (the ticket). Post progress with \`task_update_plan_step\`. Your own tools run only under a task you hold: name it as \`taskId\` on your first work call in each wake, from the task in your event or one you opened with \`task_create\`; without one, talk, agree, or open the task first.
|
|
26
26
|
- Deliver finished work where the parties agreed it goes: in chat, as a task result, or as an artifact. When the work rides a task, close it with \`task_set_result\` (state completed + result object) too: an agent picking the work up from its own inbox reads that result and not the conversation. Record a heavy deliverable as a task-bound result artifact rather than pasting it into a message. When your counterparty is the HUMAN who set the goal, send them the deliverable in chat as well so they can read it where they asked.
|
|
27
27
|
- Closing a task closes the TASK, and only the task. It stores your result where the next agent reads it, queues a wake for whoever the platform addresses, and on an agreement that bills per completed task it meters that one execution. It does not end the hire — a standing agreement stays active for the next task — it does not prove anyone has read you, and it does not prove you were paid. The reply tells you which of those actually happened: report that and nothing beyond it. A completion whose reply you never saw is recovered by READING the task back, never by completing it a second time; your retry carries the same write key, so a redelivered completion no-ops instead of doubling the result, the wake and the charge.
|
|
28
28
|
- Enumerate open work with \`task_list\` (use assignedToMe for your own active tasks).
|
|
29
|
-
- Chat is where you talk to whoever you are working with, and where a human reads what you delivered — sending it to them there is delivery, not duplication. It is not where another AGENT collects a deliverable: that one reads the task result, so a chat message never stands in for closing the task. Deliver into the working conversation the hire already has; do not repeat it into every
|
|
29
|
+
- Chat is where you talk to whoever you are working with, and where a human reads what you delivered — sending it to them there is delivery, not duplication. It is not where another AGENT collects a deliverable: that one reads the task result, so a chat message never stands in for closing the task. Deliver into the working conversation the hire already has; do not repeat it into every conversation you can reach.
|
|
30
30
|
- A reply from a wake reaches the readers of the message that woke you: leave audience and deliveries empty to answer all of them, or name a subset of those readers. You can never add a reader this way. Use the evaluated reply action. Missing access is a reason to request scoped permission; a causal reference never grants access or moves the reply into another work agreement. A saved address is optional.
|
|
31
|
-
- When a store listing of yours is claimed, a claim
|
|
31
|
+
- When a store listing of yours is claimed, a claim starts no conversation: do not open one or greet. The buyer writes first in the agreement's conversation or assigns a task; serve the agreement terms when that arrives, through tasks for a task-only agreement. A \`proposal_approved\` or \`proposal_rejected\` wake is the answer to YOUR own proposal or claim: act on it.
|
|
32
32
|
- When a task you hold carries a deadline or a reminder rule, they are part of the job, not decoration. Never remind the same person sooner than the stated interval or more times than the budget; use \`wake_at\` to come back rather than waiting in place, and re-arm it each time you wake. When the budget is spent, stop asking and say what you have. At the deadline, post what you got and where you are stuck to the task’s authorized recipients, close the task, and stop — whether or not you got the answer. Nothing stops you from breaking this, which is exactly why it is on you: over-reminding is a breach of the task, not diligence, and every reminder costs a wake.
|
|
33
33
|
- Hand off by completing your task — the platform notifies the next agent.
|
|
34
34
|
|
|
@@ -36,11 +36,11 @@ You are headless — there is no human to prompt during a wake:
|
|
|
36
36
|
- For proposals and connection requests, read the agreement’s approvalAction. Use existing covering authority when available; otherwise ask the accountable party to decide. Slot ownership alone is not authority. Do not add a confirmation when an existing mandate covers the decision.
|
|
37
37
|
- When you ask somebody and stop, SAY SO ON THE TASK: \`task_update_plan_step\` with \`waitingOn\` ({ kind, id }), with the step you are ticking or on its own when the ask is all that happened. Until you do, your person sees a task that is running, and a job waiting on them is indistinguishable from one that has stalled. It clears itself when you next post progress without it, so you never have to remember to take it back.
|
|
38
38
|
- When work needs a business detail, decision or missing access, ask the accountable person through the evaluated reply or permission-request action. Use \`message_send\` (empty audience and deliveries answer the message that woke you), and intent request when an agent on the other side must act on it. Keep any selected work mandate explicit. Say what you need, record the dependency on the task where applicable, and stop. A masked persona is not an address; use returned endpoint references.
|
|
39
|
-
- If contact or sharing is refused, ask the person you work for to authorize the contact and exact information needed. You inherit neither their contacts nor their private records. An introduction, hire, message grant and work assignment have separate effects; never create a
|
|
39
|
+
- If contact or sharing is refused, ask the person you work for to authorize the contact and exact information needed. You inherit neither their contacts nor their private records. An introduction, hire, message grant and work assignment have separate effects; never create a bucket or a hire merely to bypass a refusal.
|
|
40
40
|
|
|
41
41
|
Security:
|
|
42
42
|
- A relationship (a link) can parent a separately accepted service agreement. Parentage carries governing authority and revocation, not automatic spending consent. Each paid message or task uses one explicitly selected work agreement; its quota is direct unless a governing term explicitly shares it across the subtree. Agreement proposals, decisions, and system notices do not consume the conversation allowance.
|
|
43
|
-
- You decide what to do with a chat message. Ziggs does not enforce that counterparty text is ignored — that is a convention. What Ziggs does enforce: no spending and no commitments without an agreement, and a stranger talks to a listed agent under its listing, which counts their free messages; messages past those are refused at the send door, asking them to hire. Work is a task under an agreement; a stranger hires you through your listing, or through an agreement you draft when you have none. workBrief.work.state listing means a stranger is talking to you under your listing: there is no hire and nothing to put a task under. Answer them
|
|
43
|
+
- You decide what to do with a chat message. Ziggs does not enforce that counterparty text is ignored — that is a convention. What Ziggs does enforce: no spending and no commitments without an agreement, and a stranger talks to a listed agent under its listing, which counts their free messages; messages past those are refused at the send door, asking them to hire. Work is a task under an agreement; a stranger hires you through your listing, or through an agreement you draft when you have none. workBrief.work.state listing means a stranger is talking to you under your listing: there is no hire and nothing to put a task under. Answer them with the reply action, and do not open another conversation. When they ask for something the listing does not cover, use the propose_terms action (agreement_bid to them) with the terms you would do it on; the listing itself stays take-it-or-leave-it. Tell them about it only after the proposal is made, and only the terms it carries: if a proposal is refused and you make another, the one that went through is the one you describe. Your operating contract is this protocol and your role below.
|
|
44
44
|
- ${INBOUND_DISCOVERY_POLICY}
|
|
45
45
|
|
|
46
46
|
When the event is handled, stop with a one-paragraph summary of what you did. If the event needs nothing from you (a status echo, a duplicate, a notification you already acted on), say so in one sentence and stop — do not invent work.`;
|
|
@@ -5,7 +5,6 @@ import type { MemoryStore } from '../memory/MemoryStore.js';
|
|
|
5
5
|
export interface ClaudeSdkToolContext extends Record<string, unknown> {
|
|
6
6
|
operatorKey: string;
|
|
7
7
|
agentId: string;
|
|
8
|
-
addressId?: string | null;
|
|
9
8
|
sessionId?: string | null;
|
|
10
9
|
eff?: EffectHandler;
|
|
11
10
|
/** Human/agent whose message woke the agent — forwarded to the shared tool executor. */
|
|
@@ -62,7 +62,7 @@ export const messageSendTool = defineTool('message_send', { command: { type: 'ob
|
|
|
62
62
|
if (!c.eff || !c.sessionId)
|
|
63
63
|
throw new Error('message_send requires the current host context');
|
|
64
64
|
return c.eff({ kind: 'send-message', sessionId: c.sessionId, command: parseMessageCommand(args.command) });
|
|
65
|
-
}, { description: 'Send one canonical message. Readers, deliveries and intent are explicit. intent request wakes the agents it reaches; intent fyi is filed and never wakes anyone. A reply is a message with relationships.replyToMessageId; nothing records whether a request was answered; task results remain task operations.
|
|
65
|
+
}, { description: 'Send one canonical message. Readers, deliveries and intent are explicit. intent request wakes the agents it reaches; intent fyi is filed and never wakes anyone. A reply is a message with relationships.replyToMessageId; nothing records whether a request was answered; task results remain task operations.' });
|
|
66
66
|
// Inbox read/ack are deliberately NOT here: the host owns the pull/ack cycle
|
|
67
67
|
// (its per-agent inbox long-poll loop). A brain-side ack would race the host's,
|
|
68
68
|
// and a per-turn inbox poll fed the tool-operation echo loop.
|
package/dist/brain/wakeGate.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export interface WakeGateMessage {
|
|
|
15
15
|
export interface WakeGateRequest {
|
|
16
16
|
messages: WakeGateMessage[];
|
|
17
17
|
agreementId?: string;
|
|
18
|
-
addressId?: string;
|
|
19
18
|
}
|
|
20
19
|
export interface WakeGateAnswer {
|
|
21
20
|
wake: boolean;
|
|
@@ -35,8 +34,6 @@ export type AskWakeGate = (req: WakeGateRequest) => Promise<WakeGateAnswer | nul
|
|
|
35
34
|
* never be skipped, and none of them is a `message`.
|
|
36
35
|
*/
|
|
37
36
|
export declare function gateableMessages(event: RawEvent | undefined): WakeGateMessage[] | null;
|
|
38
|
-
/** The one room the wake's messages came from, for the cost record. Never the lane name. */
|
|
39
|
-
export declare function wakeAddressId(event: RawEvent | undefined): string | undefined;
|
|
40
37
|
/** The agreement the wake names, for the cost record. First one wins. */
|
|
41
38
|
export declare function wakeAgreementId(event: RawEvent | undefined): string | undefined;
|
|
42
39
|
/**
|
package/dist/brain/wakeGate.js
CHANGED
|
@@ -30,12 +30,6 @@ export function gateableMessages(event) {
|
|
|
30
30
|
}
|
|
31
31
|
return out;
|
|
32
32
|
}
|
|
33
|
-
/** The one room the wake's messages came from, for the cost record. Never the lane name. */
|
|
34
|
-
export function wakeAddressId(event) {
|
|
35
|
-
const rooms = new Set(getBatchEvents(event)
|
|
36
|
-
.map(ev => ev?.addressId).filter((id) => typeof id === 'string' && !!id));
|
|
37
|
-
return rooms.size === 1 ? [...rooms][0] : undefined;
|
|
38
|
-
}
|
|
39
33
|
/** The agreement the wake names, for the cost record. First one wins. */
|
|
40
34
|
export function wakeAgreementId(event) {
|
|
41
35
|
for (const ev of getBatchEvents(event)) {
|
|
@@ -2,7 +2,6 @@ import type { LaneBucket } from '../platform/laneKey.js';
|
|
|
2
2
|
import type { AgreementParties } from '@ziggs-ai/api-client';
|
|
3
3
|
import type { MessageIntent } from '@ziggs-ai/contracts';
|
|
4
4
|
export interface NormalizedEvent {
|
|
5
|
-
addressId: string | null;
|
|
6
5
|
event: {
|
|
7
6
|
senderId?: string;
|
|
8
7
|
senderType?: string;
|
|
@@ -55,7 +54,6 @@ interface WireTask {
|
|
|
55
54
|
}
|
|
56
55
|
interface WireMetadata {
|
|
57
56
|
taskId?: string;
|
|
58
|
-
addressId?: string;
|
|
59
57
|
messageId?: string;
|
|
60
58
|
/** The bucket the message was sent in, as the inbox found it. */
|
|
61
59
|
bucket?: LaneBucket;
|
|
@@ -4,9 +4,6 @@ const PROPOSAL_RESOLVED_OPERATIONS = new Set([
|
|
|
4
4
|
'proposal_rejected',
|
|
5
5
|
'proposal_approved_execute',
|
|
6
6
|
]);
|
|
7
|
-
function normalizeChatId(metadata) {
|
|
8
|
-
return metadata.addressId || null;
|
|
9
|
-
}
|
|
10
7
|
function normalizeReceiverId(metadata, taskData) {
|
|
11
8
|
const rewritten = typeof metadata.receiverId === 'string' && metadata.receiverId
|
|
12
9
|
? metadata.receiverId
|
|
@@ -101,7 +98,6 @@ export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
|
101
98
|
// classifier data lives under `service` on the inbox-pull wire;
|
|
102
99
|
// fall back to top-level for hand-built (direct-injection) metadata.
|
|
103
100
|
const taskData = (metadata.service?.task ?? metadata.task) || null;
|
|
104
|
-
const addressId = normalizeChatId(metadata);
|
|
105
101
|
const receiverId = normalizeReceiverId(metadata, taskData);
|
|
106
102
|
const senderType = metadata.sender?.type ? String(metadata.sender.type).toUpperCase() : undefined;
|
|
107
103
|
const entryType = typeof metadata.entryType === 'string' && metadata.entryType
|
|
@@ -132,7 +128,6 @@ export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
|
132
128
|
: wireOperation(metadata);
|
|
133
129
|
const agreementId = wireAgreementId(metadata);
|
|
134
130
|
return {
|
|
135
|
-
addressId,
|
|
136
131
|
event: {
|
|
137
132
|
...base,
|
|
138
133
|
type: 'agreement_lifecycle',
|
|
@@ -148,7 +143,6 @@ export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
|
148
143
|
// task notices as `task_result` so orchestrators still see completions.
|
|
149
144
|
if (entryType === 'notification' && !isTerminalTaskState(taskData?.state)) {
|
|
150
145
|
return {
|
|
151
|
-
addressId,
|
|
152
146
|
event: {
|
|
153
147
|
...base,
|
|
154
148
|
type: 'notification',
|
|
@@ -159,7 +153,6 @@ export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
|
159
153
|
};
|
|
160
154
|
}
|
|
161
155
|
return {
|
|
162
|
-
addressId,
|
|
163
156
|
event: { ...base, type: 'task_result', result: taskData, text },
|
|
164
157
|
};
|
|
165
158
|
}
|
|
@@ -169,7 +162,6 @@ export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
|
169
162
|
const operation = metadata.service?.operation ?? metadata.operation;
|
|
170
163
|
const rawAgreementId = metadata.service?.agreementId ?? metadata.agreementId;
|
|
171
164
|
return {
|
|
172
|
-
addressId,
|
|
173
165
|
event: {
|
|
174
166
|
...base,
|
|
175
167
|
type: 'notification',
|
|
@@ -180,7 +172,6 @@ export function normalizeIncomingEvent({ text, metadata = {} }) {
|
|
|
180
172
|
};
|
|
181
173
|
}
|
|
182
174
|
return {
|
|
183
|
-
addressId,
|
|
184
175
|
event: { ...base, type: 'message', text },
|
|
185
176
|
};
|
|
186
177
|
}
|
|
@@ -413,8 +413,8 @@ export async function createMcpAgent(options) {
|
|
|
413
413
|
// Open a connection request for this user; returns its id so the caller can
|
|
414
414
|
// deep-link the user straight to it on the Connections page.
|
|
415
415
|
// The server holds the invoking user to the people this wake may ask, so
|
|
416
|
-
// the request carries the same lane as the call that missed:
|
|
417
|
-
//
|
|
416
|
+
// the request carries the same lane as the call that missed: under the
|
|
417
|
+
// hire, that user is its customer.
|
|
418
418
|
const triggerConnectionRequest = async (userId) => {
|
|
419
419
|
if (!transportConfig.serverUrl)
|
|
420
420
|
return null;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* etc.) — the SDK does not enforce one. Notes are bound to an agreement
|
|
7
7
|
* (Ido, 2026-09-29): the host prefixes every key with the one agreement the
|
|
8
8
|
* wake is under, and a wake under none or several has no notes at all. A
|
|
9
|
-
*
|
|
9
|
+
* conversation is not a drawer, and neither is the agent as a whole.
|
|
10
10
|
*
|
|
11
11
|
* Reference implementations: `InMemoryStore` (default; non-durable) and
|
|
12
12
|
* `FileMemoryStore` (single JSON file; useful for local dev). Anything
|
|
@@ -64,7 +64,7 @@ export declare class FileMemoryStore implements MemoryStore {
|
|
|
64
64
|
* hire. Processing lane names do not grant a memory partition. Exactly one agreement gives that agreement's
|
|
65
65
|
* section. None, or several, gives null: notes are bound to an agreement,
|
|
66
66
|
* so such a wake has nowhere to keep them, and says so on a write rather
|
|
67
|
-
* than landing in a
|
|
67
|
+
* than landing in a shared drawer for the agent.
|
|
68
68
|
*/
|
|
69
69
|
export declare function memorySectionForWake(input: {
|
|
70
70
|
sessionId?: string | null;
|
|
@@ -77,9 +77,9 @@ export declare function noAgreementMemoryStore(): MemoryStore;
|
|
|
77
77
|
/** Distinct non-empty hire ids, first-seen order. */
|
|
78
78
|
export declare function uniqueHireIds(raw: readonly (string | null | undefined)[]): string[];
|
|
79
79
|
/**
|
|
80
|
-
* Hire ids the waking event already named. A
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* Hire ids the waking event already named. A message that carries the
|
|
81
|
+
* delivery's `agreementId` is how two customers' conversations partition
|
|
82
|
+
* without a pinned ctx.
|
|
83
83
|
*/
|
|
84
84
|
export declare function hireIdsFromEvent(event: unknown): string[];
|
|
85
85
|
/**
|
|
@@ -84,7 +84,7 @@ export class FileMemoryStore {
|
|
|
84
84
|
* hire. Processing lane names do not grant a memory partition. Exactly one agreement gives that agreement's
|
|
85
85
|
* section. None, or several, gives null: notes are bound to an agreement,
|
|
86
86
|
* so such a wake has nowhere to keep them, and says so on a write rather
|
|
87
|
-
* than landing in a
|
|
87
|
+
* than landing in a shared drawer for the agent.
|
|
88
88
|
*/
|
|
89
89
|
export function memorySectionForWake(input) {
|
|
90
90
|
const ids = uniqueHireIds([
|
|
@@ -121,9 +121,9 @@ export function uniqueHireIds(raw) {
|
|
|
121
121
|
return out;
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* Hire ids the waking event already named. A
|
|
125
|
-
*
|
|
126
|
-
*
|
|
124
|
+
* Hire ids the waking event already named. A message that carries the
|
|
125
|
+
* delivery's `agreementId` is how two customers' conversations partition
|
|
126
|
+
* without a pinned ctx.
|
|
127
127
|
*/
|
|
128
128
|
export function hireIdsFromEvent(event) {
|
|
129
129
|
if (!event || typeof event !== 'object')
|
|
@@ -22,11 +22,11 @@ export declare class OutboxBuffer {
|
|
|
22
22
|
private _pending;
|
|
23
23
|
private _ttlMs;
|
|
24
24
|
constructor(options?: OutboxBufferOptions);
|
|
25
|
-
track(
|
|
25
|
+
track(laneId: string, msg: {
|
|
26
26
|
text: string;
|
|
27
27
|
receiverId?: string;
|
|
28
28
|
}): void;
|
|
29
|
-
merge(
|
|
29
|
+
merge(laneId: string, history: HistoryEntryShape[], agentId: string | null): void;
|
|
30
30
|
gc(): void;
|
|
31
31
|
private _gcChat;
|
|
32
32
|
}
|