@deepagents/experimental 4.3.0 → 5.0.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/README.md +9 -5
- package/dist/index.js +1716 -152
- package/dist/index.js.map +4 -4
- package/dist/zukhruf/agent-control-plane.d.ts +68 -0
- package/dist/zukhruf/agent-control-plane.d.ts.map +1 -0
- package/dist/zukhruf/agent-declaration-registry.d.ts +9 -0
- package/dist/zukhruf/agent-declaration-registry.d.ts.map +1 -0
- package/dist/zukhruf/agent-directory.d.ts +21 -0
- package/dist/zukhruf/agent-directory.d.ts.map +1 -0
- package/dist/zukhruf/agent-path.d.ts +15 -0
- package/dist/zukhruf/agent-path.d.ts.map +1 -0
- package/dist/zukhruf/agent-runtime.d.ts +53 -0
- package/dist/zukhruf/agent-runtime.d.ts.map +1 -0
- package/dist/zukhruf/agent-status-projector.d.ts +32 -0
- package/dist/zukhruf/agent-status-projector.d.ts.map +1 -0
- package/dist/zukhruf/agent-thread.d.ts +31 -0
- package/dist/zukhruf/agent-thread.d.ts.map +1 -0
- package/dist/zukhruf/agent-tool-context.d.ts +6 -0
- package/dist/zukhruf/agent-tool-context.d.ts.map +1 -0
- package/dist/zukhruf/agent-turn-executor.d.ts +19 -0
- package/dist/zukhruf/agent-turn-executor.d.ts.map +1 -0
- package/dist/zukhruf/agent-turn-id.d.ts +11 -0
- package/dist/zukhruf/agent-turn-id.d.ts.map +1 -0
- package/dist/zukhruf/agent.d.ts +13 -8
- package/dist/zukhruf/agent.d.ts.map +1 -1
- package/dist/zukhruf/approval-controller.d.ts +34 -0
- package/dist/zukhruf/approval-controller.d.ts.map +1 -0
- package/dist/zukhruf/approval-mutex.d.ts +5 -0
- package/dist/zukhruf/approval-mutex.d.ts.map +1 -0
- package/dist/zukhruf/index.d.ts +15 -11
- package/dist/zukhruf/index.d.ts.map +1 -1
- package/dist/zukhruf/index.js +1716 -152
- package/dist/zukhruf/index.js.map +4 -4
- package/dist/zukhruf/list-agents.d.ts +234 -0
- package/dist/zukhruf/list-agents.d.ts.map +1 -0
- package/dist/zukhruf/mailbox/coordinator.d.ts +22 -0
- package/dist/zukhruf/mailbox/coordinator.d.ts.map +1 -0
- package/dist/zukhruf/mailbox/sqlite.store.d.ts +16 -0
- package/dist/zukhruf/mailbox/sqlite.store.d.ts.map +1 -0
- package/dist/zukhruf/mailbox/store.d.ts +20 -0
- package/dist/zukhruf/mailbox/store.d.ts.map +1 -0
- package/dist/zukhruf/mailbox/types.d.ts +35 -0
- package/dist/zukhruf/mailbox/types.d.ts.map +1 -0
- package/dist/zukhruf/message-tools.d.ts +456 -0
- package/dist/zukhruf/message-tools.d.ts.map +1 -0
- package/dist/zukhruf/queue/pg-boss.turn-queue.d.ts +2 -1
- package/dist/zukhruf/queue/pg-boss.turn-queue.d.ts.map +1 -1
- package/dist/zukhruf/queue/turn-queue.d.ts +14 -0
- package/dist/zukhruf/queue/turn-queue.d.ts.map +1 -1
- package/dist/zukhruf/spawn-agent.d.ts +301 -0
- package/dist/zukhruf/spawn-agent.d.ts.map +1 -0
- package/dist/zukhruf/sqlite-approval-mutex.d.ts +17 -0
- package/dist/zukhruf/sqlite-approval-mutex.d.ts.map +1 -0
- package/package.json +8 -7
- package/dist/zukhruf/runtime.d.ts +0 -67
- package/dist/zukhruf/runtime.d.ts.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ContextStore } from '@deepagents/context';
|
|
2
|
+
import { AgentThread } from './agent-thread.ts';
|
|
3
|
+
import type { ConversationId } from './mailbox/types.ts';
|
|
4
|
+
/** ContextStore-backed directory of durable agent instances. */
|
|
5
|
+
export declare class AgentDirectory {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(store: ContextStore);
|
|
8
|
+
assertOwnerIfExists(conversation: ConversationId): Promise<void>;
|
|
9
|
+
load(conversation: ConversationId): Promise<AgentThread | undefined>;
|
|
10
|
+
loadOrCreateRoot(conversation: ConversationId, declarationName: string): Promise<AgentThread>;
|
|
11
|
+
recordLatestTurn(conversation: ConversationId, streamId: string): Promise<AgentThread>;
|
|
12
|
+
recordLatestTurnIfCurrent(conversation: ConversationId, streamId: string, expectedLastTurnId: string | undefined): Promise<AgentThread | undefined>;
|
|
13
|
+
listTree(thread: AgentThread): Promise<AgentThread[]>;
|
|
14
|
+
resolve(thread: AgentThread, target: string): Promise<AgentThread>;
|
|
15
|
+
createChild(options: {
|
|
16
|
+
parent: AgentThread;
|
|
17
|
+
taskName: string;
|
|
18
|
+
declarationName: string;
|
|
19
|
+
}): Promise<AgentThread>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=agent-directory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-directory.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent-directory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,gEAAgE;AAChE,qBAAa,cAAc;;gBAGb,KAAK,EAAE,YAAY;IAIzB,mBAAmB,CAAC,YAAY,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAQhE,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IASpE,gBAAgB,CACpB,YAAY,EAAE,cAAc,EAC5B,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC;IAyBjB,gBAAgB,CACpB,YAAY,EAAE,cAAc,EAC5B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC;IAIjB,yBAAyB,CAC7B,YAAY,EAAE,cAAc,EAC5B,QAAQ,EAAE,MAAM,EAChB,kBAAkB,EAAE,MAAM,GAAG,SAAS,GACrC,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAI7B,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAoBrD,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IASlE,WAAW,CAAC,OAAO,EAAE;QACzB,MAAM,EAAE,WAAW,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,eAAe,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,WAAW,CAAC;CA6IzB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Canonical model-facing address for one agent in a Zukhruf tree. */
|
|
2
|
+
export declare class AgentPath {
|
|
3
|
+
#private;
|
|
4
|
+
private constructor();
|
|
5
|
+
static root(): AgentPath;
|
|
6
|
+
static parse(value: string): AgentPath;
|
|
7
|
+
/** Relative targets name descendants; absolute targets keep their canonical path. */
|
|
8
|
+
resolve(target: string): AgentPath;
|
|
9
|
+
contains(candidate: AgentPath): boolean;
|
|
10
|
+
equals(other: AgentPath): boolean;
|
|
11
|
+
get isRoot(): boolean;
|
|
12
|
+
get parent(): AgentPath | null;
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=agent-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-path.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent-path.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,qBAAa,SAAS;;IAGpB,OAAO;IAIP,MAAM,CAAC,IAAI,IAAI,SAAS;IAIxB,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAqBtC,qFAAqF;IACrF,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS;IAQlC,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO;IAMvC,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIjC,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,MAAM,IAAI,SAAS,GAAG,IAAI,CAG7B;IAED,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ContextEngine, type ContextStore, StreamManager, type StreamStore } from '@deepagents/context';
|
|
2
|
+
import { type TurnInput } from './agent-control-plane.ts';
|
|
3
|
+
import type { AgentDeclaration } from './agent.ts';
|
|
4
|
+
import type { ApprovalMutex } from './approval-mutex.ts';
|
|
5
|
+
import type { MailboxStore } from './mailbox/store.ts';
|
|
6
|
+
import type { ConversationId, InterAgentCommunication, MessageDeliveryMode } from './mailbox/types.ts';
|
|
7
|
+
import type { TurnQueue } from './queue/turn-queue.ts';
|
|
8
|
+
export interface AgentRuntimeOptions {
|
|
9
|
+
store: ContextStore;
|
|
10
|
+
streamStore: StreamStore;
|
|
11
|
+
queue: TurnQueue;
|
|
12
|
+
/** Durable pending inter-agent input. Distinct from the TurnQueue scheduler. */
|
|
13
|
+
mailboxStore: MailboxStore;
|
|
14
|
+
/** Cross-process serialization for assistant-message approval transitions. */
|
|
15
|
+
approvalMutex: ApprovalMutex;
|
|
16
|
+
}
|
|
17
|
+
export interface AgentRuntimeWorkOptions {
|
|
18
|
+
concurrency?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Reconnect and cancellation view over one durable conversation. */
|
|
21
|
+
export declare class AgentObservation {
|
|
22
|
+
#private;
|
|
23
|
+
readonly engine: ContextEngine;
|
|
24
|
+
constructor(conversation: ConversationId, store: ContextStore, streams: StreamManager);
|
|
25
|
+
resume(): Promise<ReadableStream<import("@deepagents/context").StreamPart> | null>;
|
|
26
|
+
cancel(streamId?: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/** Thin host-facing composition and lifecycle façade for a Zukhruf agent tree. */
|
|
29
|
+
export declare class AgentRuntime {
|
|
30
|
+
#private;
|
|
31
|
+
constructor(root: AgentDeclaration, options: AgentRuntimeOptions);
|
|
32
|
+
enqueue(conversation: ConversationId, turn: TurnInput): Promise<{
|
|
33
|
+
id: string;
|
|
34
|
+
stream: ReadableStream<import("@deepagents/context").StreamPart>;
|
|
35
|
+
}>;
|
|
36
|
+
deliver(communication: InterAgentCommunication, mode: MessageDeliveryMode): Promise<void>;
|
|
37
|
+
approve(conversation: ConversationId, input: {
|
|
38
|
+
toolCallId: string;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
id: string;
|
|
41
|
+
stream: ReadableStream<import("@deepagents/context").StreamPart>;
|
|
42
|
+
}>;
|
|
43
|
+
deny(conversation: ConversationId, input: {
|
|
44
|
+
toolCallId: string;
|
|
45
|
+
reason?: string;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
id: string;
|
|
48
|
+
stream: ReadableStream<import("@deepagents/context").StreamPart>;
|
|
49
|
+
}>;
|
|
50
|
+
observe(conversation: ConversationId): AgentObservation;
|
|
51
|
+
work(options?: AgentRuntimeWorkOptions): Promise<AsyncDisposable>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=agent-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-runtime.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,YAAY,EAEjB,aAAa,EACb,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAM7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,uB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
|
2
|
+
import type { AgentDirectory } from './agent-directory.ts';
|
|
3
|
+
import type { AgentThread } from './agent-thread.ts';
|
|
4
|
+
import type { ApprovalController } from './approval-controller.ts';
|
|
5
|
+
import type { MailboxCoordinator } from './mailbox/coordinator.ts';
|
|
6
|
+
import type { TurnQueue, TurnRef } from './queue/turn-queue.ts';
|
|
7
|
+
export type ListedAgentStatus = 'pending_init' | 'running' | 'waiting_approval' | 'interrupted' | {
|
|
8
|
+
completed: string | null;
|
|
9
|
+
} | {
|
|
10
|
+
errored: string;
|
|
11
|
+
};
|
|
12
|
+
export interface ListedAgent {
|
|
13
|
+
agent_name: string;
|
|
14
|
+
agent_status: ListedAgentStatus;
|
|
15
|
+
last_task_message: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface AgentStatusProjectorOptions {
|
|
18
|
+
store: ContextStore;
|
|
19
|
+
streams: StreamManager;
|
|
20
|
+
queue: TurnQueue;
|
|
21
|
+
mailbox: MailboxCoordinator;
|
|
22
|
+
directory: AgentDirectory;
|
|
23
|
+
approvals: ApprovalController;
|
|
24
|
+
}
|
|
25
|
+
/** Projects durable execution state into agent-facing status and terminal mail. */
|
|
26
|
+
export declare class AgentStatusProjector {
|
|
27
|
+
#private;
|
|
28
|
+
constructor(options: AgentStatusProjectorOptions);
|
|
29
|
+
projectListedAgent(currentTurn: TurnRef, thread: AgentThread): Promise<ListedAgent>;
|
|
30
|
+
projectTerminal(turn: TurnRef, thread: AgentThread): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=agent-status-projector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-status-projector.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent-status-projector.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAMnE,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GACzB,cAAc,GACd,SAAS,GACT,kBAAkB,GAClB,aAAa,GACb;IAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC5B;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExB,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,iBAAiB,CAAC;IAChC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED,mFAAmF;AACnF,qBAAa,oBAAoB;;gBAQnB,OAAO,EAAE,2BAA2B;IAS1C,kBAAkB,CACtB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,WAAW,CAAC;IAkCjB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA0GzE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AgentPath } from './agent-path.ts';
|
|
2
|
+
import type { ConversationId } from './mailbox/types.ts';
|
|
3
|
+
export interface AgentThreadOptions {
|
|
4
|
+
conversation: ConversationId;
|
|
5
|
+
treeId: string;
|
|
6
|
+
path: AgentPath;
|
|
7
|
+
parentChatId: string | null;
|
|
8
|
+
declarationName: string;
|
|
9
|
+
lastTurnId?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Durable identity and persisted metadata for one agent instance. */
|
|
12
|
+
export declare class AgentThread {
|
|
13
|
+
#private;
|
|
14
|
+
readonly conversation: ConversationId;
|
|
15
|
+
readonly treeId: string;
|
|
16
|
+
readonly path: AgentPath;
|
|
17
|
+
readonly parentChatId: string | null;
|
|
18
|
+
readonly declarationName: string;
|
|
19
|
+
readonly lastTurnId?: string;
|
|
20
|
+
constructor(options: AgentThreadOptions);
|
|
21
|
+
static root(conversation: ConversationId, declarationName: string): AgentThread;
|
|
22
|
+
static metadataFilter(treeId: string): {
|
|
23
|
+
key: string;
|
|
24
|
+
value: string;
|
|
25
|
+
};
|
|
26
|
+
static hasReservedMetadata(metadata: Record<string, unknown> | undefined): boolean;
|
|
27
|
+
static fromMetadata(conversation: ConversationId, metadata: Record<string, unknown> | undefined): AgentThread | undefined;
|
|
28
|
+
withLatestTurn(lastTurnId: string): AgentThread;
|
|
29
|
+
toMetadata(metadata: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=agent-thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-thread.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent-thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,cAAc,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,sEAAsE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C/D,YAAY,EAAE,iBAAiB,CAAC;IAChC,KAAK,EAAE,UAAU,CAAC;CACnB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ContextStore, type StreamManager } from '@deepagents/context';
|
|
2
|
+
import type { AgentControlPlane } from './agent-control-plane.ts';
|
|
3
|
+
import type { ApprovalController } from './approval-controller.ts';
|
|
4
|
+
import type { MailboxCoordinator } from './mailbox/coordinator.ts';
|
|
5
|
+
import type { ConsumeContext, TurnRef } from './queue/turn-queue.ts';
|
|
6
|
+
export interface AgentTurnExecutorOptions {
|
|
7
|
+
store: ContextStore;
|
|
8
|
+
streams: StreamManager;
|
|
9
|
+
controlPlane: AgentControlPlane;
|
|
10
|
+
mailbox: MailboxCoordinator;
|
|
11
|
+
approvals: ApprovalController;
|
|
12
|
+
}
|
|
13
|
+
/** Executes one queued turn without owning host lifecycle or agent routing. */
|
|
14
|
+
export declare class AgentTurnExecutor {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(options: AgentTurnExecutorOptions);
|
|
17
|
+
execute(turn: TurnRef, context: ConsumeContext): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=agent-turn-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-turn-executor.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent-turn-executor.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAKnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAMnE,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrE,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,YAAY,EAAE,iBAAiB,CAAC;IAChC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAMD,+EAA+E;AAC/E,qBAAa,iBAAiB;;gBAOhB,OAAO,EAAE,wBAAwB;IAQvC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAiOrE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConversationId } from './mailbox/types.ts';
|
|
2
|
+
/** Conversation-scoped durable identity for one caller-supplied turn key. */
|
|
3
|
+
export declare class AgentTurnId {
|
|
4
|
+
#private;
|
|
5
|
+
private constructor();
|
|
6
|
+
static fromRequest(conversation: ConversationId, requestId: string): AgentTurnId;
|
|
7
|
+
static random(conversation: ConversationId): AgentTurnId;
|
|
8
|
+
static assertOwner(conversation: ConversationId, streamId: string): void;
|
|
9
|
+
toString(): string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=agent-turn-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-turn-id.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent-turn-id.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,6EAA6E;AAC7E,qBAAa,WAAW;;IAItB,OAAO;IAIP,MAAM,CAAC,WAAW,CAChB,YAAY,EAAE,cAAc,EAC5B,SAAS,EAAE,MAAM,GAChB,WAAW;IAUd,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,GAAG,WAAW;IAIxD,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IASxE,QAAQ,IAAI,MAAM;CAanB"}
|
package/dist/zukhruf/agent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ToolSet } from 'ai';
|
|
1
|
+
import type { ToolSet, generateText } from 'ai';
|
|
2
2
|
import type { AgentModel, AgentSandbox, ContextFragment } from '@deepagents/context';
|
|
3
3
|
/**
|
|
4
4
|
* Sandboxes are per-chat: the factory receives the conversation identity so
|
|
@@ -10,17 +10,22 @@ export interface SandboxContext {
|
|
|
10
10
|
userId: string;
|
|
11
11
|
}
|
|
12
12
|
export interface AgentDeclaration {
|
|
13
|
+
/**
|
|
14
|
+
* Stable declaration identity persisted in conversation metadata.
|
|
15
|
+
* It must be unique in one declaration graph and must not be renamed while
|
|
16
|
+
* conversations created from that graph still exist.
|
|
17
|
+
*/
|
|
13
18
|
name: string;
|
|
14
19
|
model: AgentModel;
|
|
15
20
|
sandbox: (context: SandboxContext) => Promise<AgentSandbox>;
|
|
16
21
|
instructions: ContextFragment[];
|
|
17
22
|
tools?: ToolSet;
|
|
23
|
+
subagents?: AgentDeclaration[];
|
|
24
|
+
telemetry?: Parameters<typeof generateText>[0]['telemetry'];
|
|
18
25
|
}
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
name?: string;
|
|
25
|
-
}): AgentDeclaration;
|
|
26
|
+
export interface DefinedAgentDeclaration extends AgentDeclaration {
|
|
27
|
+
tools: ToolSet;
|
|
28
|
+
subagents: AgentDeclaration[];
|
|
29
|
+
}
|
|
30
|
+
export declare function defineAgent(declaration: AgentDeclaration): DefinedAgentDeclaration;
|
|
26
31
|
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/zukhruf/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEhD,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5D,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED,wBAAgB,WAAW,CACzB,WAAW,EAAE,gBAAgB,GAC5B,uBAAuB,CAUzB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type UIMessage } from 'ai';
|
|
2
|
+
import { type ContextStore, type StreamManager } from '@deepagents/context';
|
|
3
|
+
import type { ApprovalMutex } from './approval-mutex.ts';
|
|
4
|
+
import type { ConversationId } from './mailbox/types.ts';
|
|
5
|
+
import type { TurnQueue } from './queue/turn-queue.ts';
|
|
6
|
+
export interface ApprovalControllerOptions {
|
|
7
|
+
store: ContextStore;
|
|
8
|
+
streams: StreamManager;
|
|
9
|
+
queue: TurnQueue;
|
|
10
|
+
mutex: ApprovalMutex;
|
|
11
|
+
}
|
|
12
|
+
/** Durable approval-response and continuation state machine. */
|
|
13
|
+
export declare class ApprovalController {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(options: ApprovalControllerOptions);
|
|
16
|
+
isPaused(message: UIMessage | undefined): boolean;
|
|
17
|
+
approve(conversation: ConversationId, input: {
|
|
18
|
+
toolCallId: string;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
stream: ReadableStream<import("@deepagents/context").StreamPart>;
|
|
22
|
+
}>;
|
|
23
|
+
deny(conversation: ConversationId, input: {
|
|
24
|
+
toolCallId: string;
|
|
25
|
+
reason?: string;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
id: string;
|
|
28
|
+
stream: ReadableStream<import("@deepagents/context").StreamPart>;
|
|
29
|
+
}>;
|
|
30
|
+
settleDeniedApprovals(conversation: ConversationId, streamId: string): Promise<void>;
|
|
31
|
+
settleFailedApprovals(conversation: ConversationId, streamId: string, error: string): Promise<void>;
|
|
32
|
+
reconcileTerminalContinuation(conversation: ConversationId, streamId: string, status: 'completed' | 'failed' | 'cancelled', error?: string | null): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=approval-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-controller.d.ts","sourceRoot":"","sources":["../../src/zukhruf/approval-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,IAAI,CAAC;AAEZ,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;CACtB;AAID,gEAAgE;AAChE,qBAAa,kBAAkB;;gBAYjB,OAAO,EAAE,yBAAyB;IAO9C,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO;IAOjD,OAAO,CAAC,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;;;;IAMnE,IAAI,CACF,YAAY,EAAE,cAAc,EAC5B,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;;;;IAQ1C,qBAAqB,CACzB,YAAY,EAAE,cAAc,EAC5B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAyBV,qBAAqB,CACzB,YAAY,EAAE,cAAc,EAC5B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;IAwBV,6BAA6B,CACjC,YAAY,EAAE,cAAc,EAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,EAC5C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAAC,IAAI,CAAC;CA6IjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-mutex.d.ts","sourceRoot":"","sources":["../../src/zukhruf/approval-mutex.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8BAAsB,aAAa;IACjC,QAAQ,CAAC,YAAY,CAAC,CAAC,EACrB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC,CAAC,CAAC;CACd"}
|
package/dist/zukhruf/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
1
|
+
export * from './agent-thread.ts';
|
|
2
|
+
export * from './agent.ts';
|
|
3
|
+
export * from './agent-path.ts';
|
|
4
|
+
export * from './agent-runtime.ts';
|
|
5
|
+
export * from './approval-mutex.ts';
|
|
6
|
+
export type { TurnInput } from './agent-control-plane.ts';
|
|
7
|
+
export * from './instructions.ts';
|
|
8
|
+
export * from './mailbox/sqlite.store.ts';
|
|
9
|
+
export * from './mailbox/store.ts';
|
|
10
|
+
export * from './mailbox/types.ts';
|
|
11
|
+
export * from './queue/pg-boss.turn-queue.ts';
|
|
12
|
+
export * from './queue/turn-queue.ts';
|
|
13
|
+
export * from './sandbox/define.ts';
|
|
14
|
+
export * from './sqlite-approval-mutex.ts';
|
|
15
|
+
export * from './tool.ts';
|
|
12
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zukhruf/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zukhruf/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,WAAW,CAAC"}
|