@hy-sde-org/dsh-graph-control 0.1.2-rc.1

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.
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Contract types for the Agent Graph control plane.
3
+ *
4
+ * Names, shapes, and invariants ported from Maka `packages/core/src/agent-graph-*
5
+ * (schedule/control/topology/supervisor-wake)`; the fork-specific adaptations are
6
+ * (a) no epoch table — one DSH session owns one graph, so graph identity is the
7
+ * session identity for the first slice, and (b) no `schemaVersion` on every row
8
+ * is enforced here beyond the constants below (the unit-level version stamp in
9
+ * the storage layer covers it).
10
+ * @module
11
+ */
12
+ export declare const AGENT_GRAPH_SCHEDULE_SCHEMA_VERSION: 1;
13
+ export declare const AGENT_GRAPH_INTENT_CLAIM_SCHEMA_VERSION: 1;
14
+ /** Maka bounds, kept verbatim (see `agent-graph-schedule.ts`). */
15
+ export declare const MAX_ADD_WORK = 32;
16
+ export declare const MAX_INPUT_IDS = 64;
17
+ export declare const MAX_SELECTED_RESULT_INPUTS = 64;
18
+ export declare const MAX_SCHEDULE_INSTRUCTION_LENGTH = 60000;
19
+ export declare const MAX_WORK_STOPS = 20;
20
+ /** Identity of the runtime call that produced a supervisor decision. */
21
+ export interface AgentGraphScheduleUpdateSource {
22
+ readonly sessionId: string;
23
+ readonly runId: string;
24
+ readonly turnId: string;
25
+ readonly toolCallId: string;
26
+ /** Maka allows the caller to stamp its orchestration mode; informational. */
27
+ readonly orchestrationMode?: 'graph' | 'swarm';
28
+ }
29
+ /** Where a piece of work runs: a catalog agent, a preset, or an existing operator. */
30
+ export interface AgentGraphWorkTarget {
31
+ readonly kind: 'agent' | 'preset' | 'operator';
32
+ readonly id: string;
33
+ }
34
+ /** A committed-result reference read from an earlier (possibly closed) graph epoch. */
35
+ export interface AgentGraphSelectedResultInput {
36
+ readonly sourceGraphId: string;
37
+ readonly resultId: string;
38
+ }
39
+ /** One piece of scheduled work on the graph. */
40
+ export interface AgentGraphScheduledWork {
41
+ readonly workId: string;
42
+ /** Where this work runs: a catalog agent, an agent preset, or an existing operator. */
43
+ readonly target: AgentGraphWorkTarget;
44
+ readonly instruction: string;
45
+ readonly inputIds: readonly string[];
46
+ readonly selectedResultInputs?: readonly AgentGraphSelectedResultInput[];
47
+ /** Work this item supersedes (the superseded work keeps its durable row). */
48
+ readonly replaces?: string;
49
+ readonly replacementMode?: 'none' | 'replace';
50
+ }
51
+ /** Stop a work item or an activation. */
52
+ export interface AgentGraphScheduleStop {
53
+ readonly targetId: string;
54
+ readonly reason: string;
55
+ }
56
+ /** Terminal closure: the named committed record ids are the graph's selected results. */
57
+ export interface AgentGraphScheduleFinish {
58
+ readonly resultIds: readonly string[];
59
+ readonly reason: string;
60
+ }
61
+ /** One idempotent supervisor decision (add work / stop / finish). */
62
+ export interface AgentGraphScheduleUpdateRequest {
63
+ readonly schemaVersion: typeof AGENT_GRAPH_SCHEDULE_SCHEMA_VERSION;
64
+ /** Deterministic id: `graph_update_<sha256(graphId + source)>`; retries reuse it. */
65
+ readonly updateId: string;
66
+ /** Deterministic fingerprint of the semantic payload; idempotency is verified against it. */
67
+ readonly updateFingerprint: string;
68
+ readonly graphId: string;
69
+ readonly source: AgentGraphScheduleUpdateSource;
70
+ readonly addWork: readonly AgentGraphScheduledWork[];
71
+ readonly stop: readonly AgentGraphScheduleStop[];
72
+ readonly finish?: AgentGraphScheduleFinish;
73
+ }
74
+ /** A committed schedule update: the request plus its durable revision/commit stamp. */
75
+ export interface AgentGraphScheduleUpdate extends AgentGraphScheduleUpdateRequest {
76
+ readonly revision: number;
77
+ readonly committedAt: number;
78
+ }
79
+ export interface AgentGraphScheduleUpdateResult {
80
+ readonly update: AgentGraphScheduleUpdate;
81
+ readonly created: boolean;
82
+ }
83
+ /**
84
+ * Exactly-once admission authority for one runnable graph intent. The target
85
+ * turn/run ids are allocated BEFORE any runtime action; a retry observes the
86
+ * same activation identity instead of starting a second activation.
87
+ */
88
+ export interface AgentGraphIntentClaimRequest {
89
+ readonly schemaVersion: typeof AGENT_GRAPH_INTENT_CLAIM_SCHEMA_VERSION;
90
+ readonly claimId: string;
91
+ readonly graphId: string;
92
+ readonly intentId: string;
93
+ readonly intentFingerprint: string;
94
+ readonly readinessContextFingerprint: string;
95
+ readonly targetOperatorId: string;
96
+ readonly targetSessionId: string;
97
+ readonly targetTurnId: string;
98
+ readonly targetRunId: string;
99
+ }
100
+ export interface AgentGraphIntentClaim extends AgentGraphIntentClaimRequest {
101
+ readonly claimedAt: number;
102
+ }
103
+ export interface AgentGraphIntentClaimResult {
104
+ readonly claim: AgentGraphIntentClaim;
105
+ readonly created: boolean;
106
+ }
107
+ export type AgentGraphIntentAdmissionState = 'claimed' | 'executing' | 'cancelled';
108
+ export interface AgentGraphIntentAdmissionTransition {
109
+ readonly state: AgentGraphIntentAdmissionState;
110
+ readonly previousState: AgentGraphIntentAdmissionState;
111
+ readonly changed: boolean;
112
+ }
113
+ /** One monotonic operator addition (DAG addition; edges only ever point into the new operator). */
114
+ export interface AgentGraphProvisionedEdge {
115
+ readonly edgeId: string;
116
+ readonly fromOperatorId: string;
117
+ readonly toOperatorId: string;
118
+ }
119
+ export interface AgentGraphOperatorProvisionRequest {
120
+ readonly provisionId: string;
121
+ readonly graphId: string;
122
+ readonly workId: string;
123
+ /** Deterministic: `graph_operator_<sha256(graphId + workId)>`. */
124
+ readonly operatorId: string;
125
+ readonly targetSessionId: string;
126
+ readonly initialTurnId: string;
127
+ readonly initialRunId: string;
128
+ /** Fingerprint over the full provision (target, edges, profile) — adopt-on-retry equality. */
129
+ readonly provisionFingerprint: string;
130
+ readonly edges: readonly AgentGraphProvisionedEdge[];
131
+ /** Expected schedule revision the provision is linearized against. */
132
+ readonly expectedScheduleRevision: number;
133
+ }
134
+ export interface AgentGraphOperatorProvision extends Omit<AgentGraphOperatorProvisionRequest, 'expectedScheduleRevision'> {
135
+ readonly provisionedAt: number;
136
+ }
137
+ export interface AgentGraphOperatorProvisionResult {
138
+ readonly provision: AgentGraphOperatorProvision;
139
+ readonly created: boolean;
140
+ }
141
+ /** One operator worktree binding: the durable lease a provisioned child runs in. */
142
+ export interface AgentGraphOperatorBinding {
143
+ readonly graphId: string;
144
+ readonly workId: string;
145
+ readonly provisionId: string;
146
+ readonly leaseId: string;
147
+ /** Absolute workspace path of the leased worktree. */
148
+ readonly path: string;
149
+ /** Absolute root of the repository the worktree belongs to. */
150
+ readonly repoRoot: string;
151
+ readonly boundAt: number;
152
+ }
153
+ export type AgentGraphSupervisorWakeStatus = 'pending' | 'running' | 'waiting_permission' | 'delivered' | 'superseded' | 'retryable_failed';
154
+ export interface AgentGraphSupervisorWakeRecord {
155
+ readonly wakeId: string;
156
+ readonly graphId: string;
157
+ readonly snapshotVersion: string;
158
+ readonly rootSessionId: string;
159
+ readonly status: AgentGraphSupervisorWakeStatus;
160
+ readonly attemptCount: number;
161
+ readonly currentAttemptId?: string;
162
+ readonly currentTurnId?: string;
163
+ readonly createdAt: number;
164
+ readonly updatedAt: number;
165
+ readonly supersededReason?: string;
166
+ }
167
+ export interface AgentGraphSupervisorWakeAttemptRecord {
168
+ readonly attemptId: string;
169
+ readonly wakeId: string;
170
+ readonly graphId: string;
171
+ readonly turnId: string;
172
+ readonly status: 'running' | 'waiting_permission' | 'delivered' | 'superseded' | 'retryable_failed';
173
+ readonly startedAt: number;
174
+ readonly completedAt?: number;
175
+ readonly failureReason?: string;
176
+ }
177
+ export interface ClaimAgentGraphSupervisorWakeRequest {
178
+ readonly graphId: string;
179
+ readonly wakeId: string;
180
+ readonly snapshotVersion: string;
181
+ readonly rootSessionId: string;
182
+ }
183
+ export interface BeginAgentGraphSupervisorWakeAttemptRequest {
184
+ readonly graphId: string;
185
+ readonly wakeId: string;
186
+ readonly attemptId: string;
187
+ readonly turnId: string;
188
+ }
189
+ export interface CompleteAgentGraphSupervisorWakeAttemptRequest {
190
+ readonly graphId: string;
191
+ readonly wakeId: string;
192
+ readonly attemptId: string;
193
+ readonly status: 'waiting_permission' | 'delivered' | 'superseded' | 'retryable_failed';
194
+ readonly failureReason?: string;
195
+ }
196
+ export interface SupersedeAgentGraphSupervisorWakesRequest {
197
+ readonly rootSessionIds: readonly string[];
198
+ /** Optional exact graph identities; omitted means every graph under the roots. */
199
+ readonly graphIds?: readonly string[];
200
+ readonly reason: string;
201
+ }
202
+ /** Whole-unit snapshot returned by {@link GraphControlStore.snapshot} (diagnostics/tests). */
203
+ export interface AgentGraphControlSnapshot {
204
+ readonly scheduleUpdates: readonly AgentGraphScheduleUpdate[];
205
+ readonly intentClaims: readonly AgentGraphIntentClaim[];
206
+ readonly operatorProvisions: readonly AgentGraphOperatorProvision[];
207
+ readonly operatorBindings: readonly AgentGraphOperatorBinding[];
208
+ readonly supervisorWakes: readonly AgentGraphSupervisorWakeRecord[];
209
+ }
210
+ export declare function graphUpdateId(graphId: string, source: AgentGraphScheduleUpdateSource): string;
211
+ export declare function graphIntentId(graphId: string, workId: string): string;
212
+ export declare function graphOperatorId(graphId: string, workId: string): string;
213
+ export declare function graphClaimId(graphId: string, intentId: string): string;
214
+ export declare function graphProvisionId(graphId: string, workId: string): string;
215
+ export declare function graphWakeId(graphId: string, snapshotVersion: string): string;
216
+ export declare function graphWakeAttemptId(wakeId: string, attemptIndex: number): string;
217
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,mCAAmC,EAAG,CAAU,CAAA;AAC7D,eAAO,MAAM,uCAAuC,EAAG,CAAU,CAAA;AAEjE,kEAAkE;AAClE,eAAO,MAAM,YAAY,KAAK,CAAA;AAC9B,eAAO,MAAM,aAAa,KAAK,CAAA;AAC/B,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAC5C,eAAO,MAAM,+BAA+B,QAAS,CAAA;AACrD,eAAO,MAAM,cAAc,KAAK,CAAA;AAEhC,wEAAw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/**
3
+ * Contract types for the Agent Graph control plane.
4
+ *
5
+ * Names, shapes, and invariants ported from Maka `packages/core/src/agent-graph-*
6
+ * (schedule/control/topology/supervisor-wake)`; the fork-specific adaptations are
7
+ * (a) no epoch table — one DSH session owns one graph, so graph identity is the
8
+ * session identity for the first slice, and (b) no `schemaVersion` on every row
9
+ * is enforced here beyond the constants below (the unit-level version stamp in
10
+ * the storage layer covers it).
11
+ * @module
12
+ */
13
+ export const AGENT_GRAPH_SCHEDULE_SCHEMA_VERSION = 1;
14
+ export const AGENT_GRAPH_INTENT_CLAIM_SCHEMA_VERSION = 1;
15
+ /** Maka bounds, kept verbatim (see `agent-graph-schedule.ts`). */
16
+ export const MAX_ADD_WORK = 32;
17
+ export const MAX_INPUT_IDS = 64;
18
+ export const MAX_SELECTED_RESULT_INPUTS = 64;
19
+ export const MAX_SCHEDULE_INSTRUCTION_LENGTH = 60_000;
20
+ export const MAX_WORK_STOPS = 20;
21
+ /* ------------------------------------------------------------------ */
22
+ /* Deterministic id helpers (sha256; Maka's `graph_*` id vocabulary). */
23
+ /* ------------------------------------------------------------------ */
24
+ function hash(...parts) {
25
+ return createHash('sha256').update(parts.join('\u0000')).digest('hex');
26
+ }
27
+ export function graphUpdateId(graphId, source) {
28
+ return `graph_update_${hash(graphId, source.sessionId, source.runId, source.turnId, source.toolCallId)}`;
29
+ }
30
+ export function graphIntentId(graphId, workId) {
31
+ return `graph_intent_${hash(graphId, workId)}`;
32
+ }
33
+ export function graphOperatorId(graphId, workId) {
34
+ return `graph_operator_${hash(graphId, workId)}`;
35
+ }
36
+ export function graphClaimId(graphId, intentId) {
37
+ return `graph_claim_${hash(graphId, intentId)}`;
38
+ }
39
+ export function graphProvisionId(graphId, workId) {
40
+ return `graph_provision_${hash(graphId, workId)}`;
41
+ }
42
+ export function graphWakeId(graphId, snapshotVersion) {
43
+ return `graph_wake_${hash(graphId, snapshotVersion)}`;
44
+ }
45
+ export function graphWakeAttemptId(wakeId, attemptIndex) {
46
+ return `graph_wake_attempt_${hash(wakeId, String(attemptIndex))}`;
47
+ }
48
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAU,CAAA;AAC7D,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAU,CAAA;AAEjE,kEAAkE;AAClE,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAA;AAC9B,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAA;AAC/B,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAA;AAC5C,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAA;AACrD,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAA;AAiOhC,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAGxE,SAAS,IAAI,CAAC,GAAG,KAAe;IAC9B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACxE,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,MAAsC;IACnF,OAAO,gBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,CAAA;AAC1G,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,MAAc;IAC3D,OAAO,gBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAA;AAChD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,MAAc;IAC7D,OAAO,kBAAkB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,QAAgB;IAC5D,OAAO,eAAe,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAA;AACjD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,MAAc;IAC9D,OAAO,mBAAmB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAA;AACnD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,eAAuB;IAClE,OAAO,cAAc,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,CAAA;AACvD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,YAAoB;IACrE,OAAO,sBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAA;AACnE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@hy-sde-org/dsh-graph-control",
3
+ "description": "Durable control plane for the Agent Graph: schedule updates, exactly-once intent claims, operator provisions, and supervisor wakes (Port 1 of Maka Agent Graph)",
4
+ "version": "0.1.2-rc.1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/graph/graph-control"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "license": "MIT",
29
+ "peerDependencies": {
30
+ "@deepseek-ai/dsh-storage": "^0.1.2-rc.1"
31
+ },
32
+ "devDependencies": {
33
+ "@deepseek-ai/dsh-storage": "^0.1.2-rc.1",
34
+ "@deepseek-ai/dsh-storage-sqlite": "^0.0.1-rc.1",
35
+ "@types/node": "^24.0.0",
36
+ "typescript": "^5.9.3",
37
+ "vitest": "^3.2.7"
38
+ },
39
+ "scripts": {
40
+ "clean": "rm -rf dist",
41
+ "build": "tsc -p tsconfig.build.json",
42
+ "check": "tsc -p tsconfig.json --noEmit",
43
+ "test": "vitest run"
44
+ }
45
+ }