@wudao-org/server 0.0.0-stage → 0.4.20
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/LICENSE +21 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1645 -0
- package/dist/index.js.map +1 -0
- package/dist/lanes.d.ts +52 -0
- package/dist/lanes.d.ts.map +1 -0
- package/dist/lanes.js +78 -0
- package/dist/lanes.js.map +1 -0
- package/dist/pet-turns.d.ts +6 -0
- package/dist/pet-turns.d.ts.map +1 -0
- package/dist/pet-turns.js +24 -0
- package/dist/pet-turns.js.map +1 -0
- package/dist/placeholder.d.ts +2 -0
- package/dist/placeholder.d.ts.map +1 -0
- package/dist/placeholder.js +48 -0
- package/dist/placeholder.js.map +1 -0
- package/dist/ports.d.ts +364 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +8 -0
- package/dist/ports.js.map +1 -0
- package/dist/probe.d.ts +39 -0
- package/dist/probe.d.ts.map +1 -0
- package/dist/probe.js +96 -0
- package/dist/probe.js.map +1 -0
- package/dist/recovery.d.ts +199 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +424 -0
- package/dist/recovery.js.map +1 -0
- package/dist/vault.d.ts +23 -0
- package/dist/vault.d.ts.map +1 -0
- package/dist/vault.js +117 -0
- package/dist/vault.js.map +1 -0
- package/package.json +43 -3
- package/README.md +0 -3
package/dist/vault.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The op names the vault covers — the MUTATIONS. Dual-form ops
|
|
2
|
+
* (`switch`, `recentWorkspaces`) vault only their mutating form (n / add
|
|
3
|
+
* present); the read form must stay uncached. Exported for the full-set
|
|
4
|
+
* mirror pin (tests/vaulted-mirror.test.ts — the server half of the web
|
|
5
|
+
* protocol test's classification pin; the wire payload arrives as parsed
|
|
6
|
+
* JSON, so the mirror is intentionally untyped Record<string, unknown>). */
|
|
7
|
+
export declare function isVaultedMutation(o: Record<string, unknown>): boolean;
|
|
8
|
+
/** Deterministic serialization for the vault digest: object keys sorted at
|
|
9
|
+
* every depth, compact separators (the same canonical form nanobot's vault
|
|
10
|
+
* hashes — key order in a JSON frame must never change the digest). */
|
|
11
|
+
export declare function canonicalJson(v: unknown): string;
|
|
12
|
+
/** One vaulted operation: what the client asked (action + payload digest),
|
|
13
|
+
* whether it settled, its reply, and the joiners awaiting that reply. */
|
|
14
|
+
export interface VaultEntry {
|
|
15
|
+
readonly action: string;
|
|
16
|
+
readonly digest: string;
|
|
17
|
+
done: boolean;
|
|
18
|
+
ok: unknown;
|
|
19
|
+
err?: string;
|
|
20
|
+
completedAt: number | null;
|
|
21
|
+
readonly joiners: ((ok: unknown, err?: string) => void)[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=vault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAMA;;;;;6EAK6E;AAC7E,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CA4FrE;AAED;;wEAEwE;AACxE,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAOhD;AAED;0EAC0E;AAC1E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,OAAO,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,EAAE,CAAC;CAC3D"}
|
package/dist/vault.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// @wudao-org/server — ω-3a 变更幂等 vault 的纯函数段外提(多 driver 并发弧 B 的
|
|
2
|
+
// 顺带件,file-size 棘轮纪律:index.ts 的白名单帽只收不涨)。逐字节搬家:
|
|
3
|
+
// isVaultedMutation / canonicalJson / VaultEntry 三段自 index.ts 原样外提;
|
|
4
|
+
// index.ts 的 re-export 门面维持既有公共面(vaulted-mirror.test.ts 把
|
|
5
|
+
// isVaultedMutation 钉在 index 导出上)。
|
|
6
|
+
/** The op names the vault covers — the MUTATIONS. Dual-form ops
|
|
7
|
+
* (`switch`, `recentWorkspaces`) vault only their mutating form (n / add
|
|
8
|
+
* present); the read form must stay uncached. Exported for the full-set
|
|
9
|
+
* mirror pin (tests/vaulted-mirror.test.ts — the server half of the web
|
|
10
|
+
* protocol test's classification pin; the wire payload arrives as parsed
|
|
11
|
+
* JSON, so the mirror is intentionally untyped Record<string, unknown>). */
|
|
12
|
+
export function isVaultedMutation(o) {
|
|
13
|
+
switch (o.op) {
|
|
14
|
+
case "submit":
|
|
15
|
+
case "interrupt":
|
|
16
|
+
case "setMode":
|
|
17
|
+
case "answerPermission":
|
|
18
|
+
// 借鉴弧 α2/α1 — both new lanes are convergent-on-replay (a replayed
|
|
19
|
+
// recall/answer finds nothing parked and answers false), but the family
|
|
20
|
+
// law vaults driver-state mutations so a mid-flap replay re-serves the
|
|
21
|
+
// original reply instead of re-executing against a MOVED queue (a same-
|
|
22
|
+
// text entry at the same index would be the wrong kill).
|
|
23
|
+
case "recallSteer":
|
|
24
|
+
case "answerAskUser":
|
|
25
|
+
// 借鉴弧 δ — convergent on replay (a replayed detach finds the call no
|
|
26
|
+
// longer in flight and answers not_in_flight), but the driver-state
|
|
27
|
+
// mutation family law vaults it: a mid-flap replay re-serves the
|
|
28
|
+
// original verdict instead of detaching a MOVED busy row.
|
|
29
|
+
case "detachToolCall":
|
|
30
|
+
case "resume":
|
|
31
|
+
case "rewind":
|
|
32
|
+
// ω-3a review M1 follow-up: /edit arming IS a mutation (an armed edit
|
|
33
|
+
// branch is driver state) — vaulted like every other mutation, so a
|
|
34
|
+
// mid-flap replay re-serves the armed text instead of re-arming.
|
|
35
|
+
case "edit":
|
|
36
|
+
case "settingsSaveKey":
|
|
37
|
+
case "settingsSet":
|
|
38
|
+
// Provider management §5: a provider write is a side effect that must
|
|
39
|
+
// survive a mid-flap replay exactly once — vaulted like settingsSet
|
|
40
|
+
// (delete converges on replay, the /models probe is a read: not vaulted).
|
|
41
|
+
case "settingsSaveProvider":
|
|
42
|
+
case "switchWorkspace":
|
|
43
|
+
case "panelRootSet":
|
|
44
|
+
case "agentRootSwitch":
|
|
45
|
+
case "attachmentSave":
|
|
46
|
+
// ω99-55: the file lane's save writes content-addressed objects — a
|
|
47
|
+
// side effect, vaulted like the image save (replay joins the original
|
|
48
|
+
// execution; a re-uploaded duplicate is a dedup no-op anyway).
|
|
49
|
+
case "fileSave":
|
|
50
|
+
case "pluginMarketAdd":
|
|
51
|
+
case "pluginMarketUpdate":
|
|
52
|
+
case "pluginMarketRemove":
|
|
53
|
+
case "pluginInstall":
|
|
54
|
+
case "pluginInstallSpec":
|
|
55
|
+
case "longtermMemoryForget": // M-Memory — tombstone 幂等 // guided-install 弧 — 与 pluginInstall 同族(重放收敛 already-exists)
|
|
56
|
+
case "pluginUninstall":
|
|
57
|
+
case "pluginEnable":
|
|
58
|
+
case "pluginDisable":
|
|
59
|
+
// persona-settings T5: persona writes are side effects — vaulted like the
|
|
60
|
+
// other registry mutations (delete converges on replay; the reads
|
|
61
|
+
// personaList/personaGet are NOT vaulted).
|
|
62
|
+
case "personaSave":
|
|
63
|
+
case "personaDelete":
|
|
64
|
+
// ω99-235: #2 — the pet lane's three ops are mutations of the SECOND
|
|
65
|
+
// driver session — vaulted exactly like their main-lane twins, so a
|
|
66
|
+
// mid-flap replay never double-submits into the sprite's lane.
|
|
67
|
+
case "petSubmit":
|
|
68
|
+
case "petInterrupt":
|
|
69
|
+
case "petAnswerPermission":
|
|
70
|
+
// ω99-260: the memory decision is a side effect (confirm flips a line,
|
|
71
|
+
// del removes it) — vaulted so a mid-flap replay never double-decides;
|
|
72
|
+
// ok/del converge (a replayed second ok answers ok:false, never breaks).
|
|
73
|
+
// ω99-264: the memory REWRITE rides the same vault seat — its replay
|
|
74
|
+
// convergence is the driver's content-equal short-circuit (a bare update
|
|
75
|
+
// is v+1 per call; the vault joins or replays the cached verdict, and a
|
|
76
|
+
// genuinely re-sent edit converges in the driver, version 恰 +1).
|
|
77
|
+
case "memoryDecide":
|
|
78
|
+
case "memoryEdit":
|
|
79
|
+
// ω99-314: the file-level time machine's restore is a WORKING-face side
|
|
80
|
+
// effect (it overwrites a workspace file) — vaulted so a mid-flap replay
|
|
81
|
+
// joins the original execution; a second revert after a later edit must
|
|
82
|
+
// be a fresh user decision, never a replayed frame.
|
|
83
|
+
case "fileRevert":
|
|
84
|
+
// ω99-317: the schedules management face's two writes — setEnabled is a
|
|
85
|
+
// state write (settingsSet shape), runNow RE-RUNS a task (a mid-flap
|
|
86
|
+
// replay would double-run) — both vaulted for exactly-once. The delete
|
|
87
|
+
// (schedulesRemove) converges on replay and stays UN-vaulted, the
|
|
88
|
+
// sessionDelete/settingsDeleteProvider precedent.
|
|
89
|
+
case "schedulesSetEnabled":
|
|
90
|
+
case "schedulesRunNow":
|
|
91
|
+
return true;
|
|
92
|
+
// 永续 v6 wave2(reef C1):改进提案面的五个决策是写副作用(consent 起
|
|
93
|
+
// 子代理+模型调用、activate 写规则文件)——vaulted 恰一次;list 是读,
|
|
94
|
+
// 与 schedulesList 同形不 vault。
|
|
95
|
+
case "improvementFace":
|
|
96
|
+
return o.action !== "list";
|
|
97
|
+
case "switch":
|
|
98
|
+
return o.n !== undefined;
|
|
99
|
+
case "recentWorkspaces":
|
|
100
|
+
return o.add !== undefined;
|
|
101
|
+
default:
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Deterministic serialization for the vault digest: object keys sorted at
|
|
106
|
+
* every depth, compact separators (the same canonical form nanobot's vault
|
|
107
|
+
* hashes — key order in a JSON frame must never change the digest). */
|
|
108
|
+
export function canonicalJson(v) {
|
|
109
|
+
if (Array.isArray(v))
|
|
110
|
+
return `[${v.map(canonicalJson).join(",")}]`;
|
|
111
|
+
if (typeof v === "object" && v !== null) {
|
|
112
|
+
const keys = Object.keys(v).sort();
|
|
113
|
+
return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalJson(v[k])}`).join(",")}}`;
|
|
114
|
+
}
|
|
115
|
+
return JSON.stringify(v) ?? "null";
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=vault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vault.js","sourceRoot":"","sources":["../src/vault.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gDAAgD;AAChD,oEAAoE;AACpE,0DAA0D;AAC1D,mCAAmC;AAEnC;;;;;6EAK6E;AAC7E,MAAM,UAAU,iBAAiB,CAAC,CAA0B;IAC1D,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,KAAK,kBAAkB,CAAC;QACxB,kEAAkE;QAClE,wEAAwE;QACxE,uEAAuE;QACvE,wEAAwE;QACxE,yDAAyD;QACzD,KAAK,aAAa,CAAC;QACnB,KAAK,eAAe,CAAC;QACrB,oEAAoE;QACpE,oEAAoE;QACpE,iEAAiE;QACjE,0DAA0D;QAC1D,KAAK,gBAAgB,CAAC;QACtB,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC;QACd,sEAAsE;QACtE,oEAAoE;QACpE,iEAAiE;QACjE,KAAK,MAAM,CAAC;QACZ,KAAK,iBAAiB,CAAC;QACvB,KAAK,aAAa,CAAC;QACnB,sEAAsE;QACtE,oEAAoE;QACpE,0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KAAK,kBAAkB;YACrB,OAAO,CAAC,CAAC,GAAG,KAAK,SAAS,CAAC;QAC7B;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;wEAEwE;AACxE,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACnE,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAA4B,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9D,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,aAAa,CAAE,CAA6B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACtH,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;AACrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wudao-org/server",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.4.20",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Localhost WS server for the wudao agent driver — first-frame auth, two-channel state protocol (see PROTOCOL.md).",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"ws": "^8.18.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/ws": "^8.5.12",
|
|
22
|
+
"typescript": "5.6.3",
|
|
23
|
+
"vitest": "2.1.8"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22"
|
|
27
|
+
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"author": "feiniaojin",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/feiniaojin/wudao-harness.git"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"agent",
|
|
36
|
+
"harness",
|
|
37
|
+
"websocket",
|
|
38
|
+
"protocol",
|
|
39
|
+
"llm"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.json",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"test:watch": "vitest"
|
|
45
|
+
}
|
|
6
46
|
}
|
package/README.md
DELETED