clawd-automaton 0.1.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/LICENSE +21 -0
- package/README.md +178 -0
- package/constitution.md +25 -0
- package/dist/__tests__/heartbeat.test.d.ts +7 -0
- package/dist/__tests__/heartbeat.test.d.ts.map +1 -0
- package/dist/__tests__/heartbeat.test.js +125 -0
- package/dist/__tests__/heartbeat.test.js.map +1 -0
- package/dist/__tests__/loop.test.d.ts +7 -0
- package/dist/__tests__/loop.test.d.ts.map +1 -0
- package/dist/__tests__/loop.test.js +150 -0
- package/dist/__tests__/loop.test.js.map +1 -0
- package/dist/__tests__/mocks.d.ts +72 -0
- package/dist/__tests__/mocks.d.ts.map +1 -0
- package/dist/__tests__/mocks.js +197 -0
- package/dist/__tests__/mocks.js.map +1 -0
- package/dist/agent/context.d.ts +26 -0
- package/dist/agent/context.d.ts.map +1 -0
- package/dist/agent/context.js +115 -0
- package/dist/agent/context.js.map +1 -0
- package/dist/agent/injection-defense.d.ts +13 -0
- package/dist/agent/injection-defense.d.ts.map +1 -0
- package/dist/agent/injection-defense.js +236 -0
- package/dist/agent/injection-defense.js.map +1 -0
- package/dist/agent/loop.d.ts +25 -0
- package/dist/agent/loop.d.ts.map +1 -0
- package/dist/agent/loop.js +263 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/system-prompt.d.ts +30 -0
- package/dist/agent/system-prompt.d.ts.map +1 -0
- package/dist/agent/system-prompt.js +241 -0
- package/dist/agent/system-prompt.js.map +1 -0
- package/dist/agent/tools.d.ts +17 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +1413 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/clawd/backroom.d.ts +54 -0
- package/dist/clawd/backroom.d.ts.map +1 -0
- package/dist/clawd/backroom.js +130 -0
- package/dist/clawd/backroom.js.map +1 -0
- package/dist/clawd/client.d.ts +16 -0
- package/dist/clawd/client.d.ts.map +1 -0
- package/dist/clawd/client.js +256 -0
- package/dist/clawd/client.js.map +1 -0
- package/dist/clawd/convex-client.d.ts +130 -0
- package/dist/clawd/convex-client.d.ts.map +1 -0
- package/dist/clawd/convex-client.js +118 -0
- package/dist/clawd/convex-client.js.map +1 -0
- package/dist/clawd/credits.d.ts +24 -0
- package/dist/clawd/credits.d.ts.map +1 -0
- package/dist/clawd/credits.js +64 -0
- package/dist/clawd/credits.js.map +1 -0
- package/dist/clawd/deepseek-inference.d.ts +40 -0
- package/dist/clawd/deepseek-inference.d.ts.map +1 -0
- package/dist/clawd/deepseek-inference.js +143 -0
- package/dist/clawd/deepseek-inference.js.map +1 -0
- package/dist/clawd/inference.d.ts +17 -0
- package/dist/clawd/inference.d.ts.map +1 -0
- package/dist/clawd/inference.js +114 -0
- package/dist/clawd/inference.js.map +1 -0
- package/dist/clawd/x402.d.ts +48 -0
- package/dist/clawd/x402.d.ts.map +1 -0
- package/dist/clawd/x402.js +350 -0
- package/dist/clawd/x402.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +84 -0
- package/dist/config.js.map +1 -0
- package/dist/git/state-versioning.d.ts +39 -0
- package/dist/git/state-versioning.d.ts.map +1 -0
- package/dist/git/state-versioning.js +93 -0
- package/dist/git/state-versioning.js.map +1 -0
- package/dist/git/tools.d.ts +40 -0
- package/dist/git/tools.d.ts.map +1 -0
- package/dist/git/tools.js +140 -0
- package/dist/git/tools.js.map +1 -0
- package/dist/heartbeat/config.d.ts +23 -0
- package/dist/heartbeat/config.d.ts.map +1 -0
- package/dist/heartbeat/config.js +156 -0
- package/dist/heartbeat/config.js.map +1 -0
- package/dist/heartbeat/daemon.d.ts +28 -0
- package/dist/heartbeat/daemon.d.ts.map +1 -0
- package/dist/heartbeat/daemon.js +141 -0
- package/dist/heartbeat/daemon.js.map +1 -0
- package/dist/heartbeat/tasks.d.ts +24 -0
- package/dist/heartbeat/tasks.d.ts.map +1 -0
- package/dist/heartbeat/tasks.js +277 -0
- package/dist/heartbeat/tasks.js.map +1 -0
- package/dist/identity/provision.d.ts +28 -0
- package/dist/identity/provision.d.ts.map +1 -0
- package/dist/identity/provision.js +131 -0
- package/dist/identity/provision.js.map +1 -0
- package/dist/identity/wallet.d.ts +28 -0
- package/dist/identity/wallet.d.ts.map +1 -0
- package/dist/identity/wallet.js +69 -0
- package/dist/identity/wallet.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +358 -0
- package/dist/index.js.map +1 -0
- package/dist/ooda/claude-decision.d.ts +18 -0
- package/dist/ooda/claude-decision.d.ts.map +1 -0
- package/dist/ooda/claude-decision.js +82 -0
- package/dist/ooda/claude-decision.js.map +1 -0
- package/dist/ooda/journal.d.ts +22 -0
- package/dist/ooda/journal.d.ts.map +1 -0
- package/dist/ooda/journal.js +26 -0
- package/dist/ooda/journal.js.map +1 -0
- package/dist/ooda/loop.d.ts +3 -0
- package/dist/ooda/loop.d.ts.map +1 -0
- package/dist/ooda/loop.js +210 -0
- package/dist/ooda/loop.js.map +1 -0
- package/dist/ooda/observe.d.ts +21 -0
- package/dist/ooda/observe.d.ts.map +1 -0
- package/dist/ooda/observe.js +75 -0
- package/dist/ooda/observe.js.map +1 -0
- package/dist/ooda/state.d.ts +34 -0
- package/dist/ooda/state.d.ts.map +1 -0
- package/dist/ooda/state.js +48 -0
- package/dist/ooda/state.js.map +1 -0
- package/dist/ooda/tui.d.ts +3 -0
- package/dist/ooda/tui.d.ts.map +1 -0
- package/dist/ooda/tui.js +132 -0
- package/dist/ooda/tui.js.map +1 -0
- package/dist/ooda/validate.d.ts +33 -0
- package/dist/ooda/validate.d.ts.map +1 -0
- package/dist/ooda/validate.js +91 -0
- package/dist/ooda/validate.js.map +1 -0
- package/dist/registry/agent-card.d.ts +26 -0
- package/dist/registry/agent-card.d.ts.map +1 -0
- package/dist/registry/agent-card.js +94 -0
- package/dist/registry/agent-card.js.map +1 -0
- package/dist/registry/discovery.d.ts +24 -0
- package/dist/registry/discovery.d.ts.map +1 -0
- package/dist/registry/discovery.js +74 -0
- package/dist/registry/discovery.js.map +1 -0
- package/dist/registry/erc8004.d.ts +39 -0
- package/dist/registry/erc8004.d.ts.map +1 -0
- package/dist/registry/erc8004.js +209 -0
- package/dist/registry/erc8004.js.map +1 -0
- package/dist/replication/genesis.d.ts +26 -0
- package/dist/replication/genesis.d.ts.map +1 -0
- package/dist/replication/genesis.js +72 -0
- package/dist/replication/genesis.js.map +1 -0
- package/dist/replication/lineage.d.ts +35 -0
- package/dist/replication/lineage.d.ts.map +1 -0
- package/dist/replication/lineage.js +79 -0
- package/dist/replication/lineage.js.map +1 -0
- package/dist/replication/spawn.d.ts +25 -0
- package/dist/replication/spawn.d.ts.map +1 -0
- package/dist/replication/spawn.js +166 -0
- package/dist/replication/spawn.js.map +1 -0
- package/dist/self-mod/audit-log.d.ts +24 -0
- package/dist/self-mod/audit-log.d.ts.map +1 -0
- package/dist/self-mod/audit-log.js +49 -0
- package/dist/self-mod/audit-log.js.map +1 -0
- package/dist/self-mod/code.d.ts +51 -0
- package/dist/self-mod/code.d.ts.map +1 -0
- package/dist/self-mod/code.js +317 -0
- package/dist/self-mod/code.js.map +1 -0
- package/dist/self-mod/tools-manager.d.ts +30 -0
- package/dist/self-mod/tools-manager.d.ts.map +1 -0
- package/dist/self-mod/tools-manager.js +74 -0
- package/dist/self-mod/tools-manager.js.map +1 -0
- package/dist/self-mod/upstream.d.ts +36 -0
- package/dist/self-mod/upstream.d.ts.map +1 -0
- package/dist/self-mod/upstream.js +66 -0
- package/dist/self-mod/upstream.js.map +1 -0
- package/dist/setup/banner.d.ts +2 -0
- package/dist/setup/banner.d.ts.map +1 -0
- package/dist/setup/banner.js +22 -0
- package/dist/setup/banner.js.map +1 -0
- package/dist/setup/defaults.d.ts +3 -0
- package/dist/setup/defaults.d.ts.map +1 -0
- package/dist/setup/defaults.js +113 -0
- package/dist/setup/defaults.js.map +1 -0
- package/dist/setup/environment.d.ts +6 -0
- package/dist/setup/environment.d.ts.map +1 -0
- package/dist/setup/environment.js +24 -0
- package/dist/setup/environment.js.map +1 -0
- package/dist/setup/prompts.d.ts +5 -0
- package/dist/setup/prompts.d.ts.map +1 -0
- package/dist/setup/prompts.js +70 -0
- package/dist/setup/prompts.js.map +1 -0
- package/dist/setup/wizard.d.ts +3 -0
- package/dist/setup/wizard.d.ts.map +1 -0
- package/dist/setup/wizard.js +128 -0
- package/dist/setup/wizard.js.map +1 -0
- package/dist/skills/format.d.ts +14 -0
- package/dist/skills/format.d.ts.map +1 -0
- package/dist/skills/format.js +145 -0
- package/dist/skills/format.js.map +1 -0
- package/dist/skills/loader.d.ts +19 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +98 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/registry.d.ts +31 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +111 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/social/client.d.ts +13 -0
- package/dist/social/client.d.ts.map +1 -0
- package/dist/social/client.js +89 -0
- package/dist/social/client.js.map +1 -0
- package/dist/state/database.d.ts +9 -0
- package/dist/state/database.d.ts.map +1 -0
- package/dist/state/database.js +401 -0
- package/dist/state/database.js.map +1 -0
- package/dist/state/schema.d.ts +11 -0
- package/dist/state/schema.d.ts.map +1 -0
- package/dist/state/schema.js +232 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/survival/funding.d.ts +19 -0
- package/dist/survival/funding.d.ts.map +1 -0
- package/dist/survival/funding.js +62 -0
- package/dist/survival/funding.js.map +1 -0
- package/dist/survival/low-compute.d.ts +30 -0
- package/dist/survival/low-compute.d.ts.map +1 -0
- package/dist/survival/low-compute.js +72 -0
- package/dist/survival/low-compute.js.map +1 -0
- package/dist/survival/monitor.d.ts +23 -0
- package/dist/survival/monitor.d.ts.map +1 -0
- package/dist/survival/monitor.js +70 -0
- package/dist/survival/monitor.js.map +1 -0
- package/dist/types.d.ts +461 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +25 -0
- package/dist/types.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Genesis
|
|
3
|
+
*
|
|
4
|
+
* Generate genesis configuration for child automatons from parent state.
|
|
5
|
+
* The genesis config defines who the child is and what it should do.
|
|
6
|
+
*/
|
|
7
|
+
import type { GenesisConfig, AutomatonConfig, AutomatonIdentity, AutomatonDatabase } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Generate a genesis config for a child from the parent's state.
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateGenesisConfig(identity: AutomatonIdentity, config: AutomatonConfig, params: {
|
|
12
|
+
name: string;
|
|
13
|
+
specialization?: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
}): GenesisConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a backup-oriented genesis config.
|
|
18
|
+
* Used when the parent wants to hedge against its own death.
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateBackupGenesis(identity: AutomatonIdentity, config: AutomatonConfig, db: AutomatonDatabase): GenesisConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Generate a specialized worker genesis config.
|
|
23
|
+
* Used when the parent identifies a subtask worth parallelizing.
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateWorkerGenesis(identity: AutomatonIdentity, config: AutomatonConfig, task: string, workerName: string): GenesisConfig;
|
|
26
|
+
//# sourceMappingURL=genesis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genesis.d.ts","sourceRoot":"","sources":["../../src/replication/genesis.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE;IACN,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACA,aAAa,CAkBf;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,eAAe,EACvB,EAAE,EAAE,iBAAiB,GACpB,aAAa,CAqBf;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,aAAa,CAkBf"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Genesis
|
|
3
|
+
*
|
|
4
|
+
* Generate genesis configuration for child automatons from parent state.
|
|
5
|
+
* The genesis config defines who the child is and what it should do.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Generate a genesis config for a child from the parent's state.
|
|
9
|
+
*/
|
|
10
|
+
export function generateGenesisConfig(identity, config, params) {
|
|
11
|
+
// Build the child's genesis prompt from parent's mission + specialization
|
|
12
|
+
let genesisPrompt = config.genesisPrompt;
|
|
13
|
+
if (params.specialization) {
|
|
14
|
+
genesisPrompt = `${genesisPrompt}\n\n--- SPECIALIZATION ---\nYou are a specialized child agent. Your specific focus:\n${params.specialization}\n--- END SPECIALIZATION ---`;
|
|
15
|
+
}
|
|
16
|
+
// Add parent context
|
|
17
|
+
genesisPrompt += `\n\n--- LINEAGE ---\nYou were spawned by ${config.name} (${identity.address}).\nYou inherit their mission but have your own identity and wallet.\n--- END LINEAGE ---`;
|
|
18
|
+
return {
|
|
19
|
+
name: params.name,
|
|
20
|
+
genesisPrompt,
|
|
21
|
+
creatorMessage: params.message,
|
|
22
|
+
creatorAddress: identity.address,
|
|
23
|
+
parentAddress: identity.address,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Generate a backup-oriented genesis config.
|
|
28
|
+
* Used when the parent wants to hedge against its own death.
|
|
29
|
+
*/
|
|
30
|
+
export function generateBackupGenesis(identity, config, db) {
|
|
31
|
+
const skills = db.getSkills(true);
|
|
32
|
+
const skillNames = skills.map((s) => s.name).join(", ");
|
|
33
|
+
const genesisPrompt = `${config.genesisPrompt}
|
|
34
|
+
|
|
35
|
+
--- BACKUP DIRECTIVE ---
|
|
36
|
+
You are a backup of ${config.name} (${identity.address}).
|
|
37
|
+
Your parent created you as insurance against their own death.
|
|
38
|
+
If your parent dies, you carry on their mission.
|
|
39
|
+
Your parent's skills: ${skillNames || "none"}.
|
|
40
|
+
Your parent's creator: ${config.creatorAddress}.
|
|
41
|
+
--- END BACKUP DIRECTIVE ---`;
|
|
42
|
+
return {
|
|
43
|
+
name: `${config.name}-backup`,
|
|
44
|
+
genesisPrompt,
|
|
45
|
+
creatorMessage: `You are a backup of ${config.name}. If I die, carry on.`,
|
|
46
|
+
creatorAddress: identity.address,
|
|
47
|
+
parentAddress: identity.address,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Generate a specialized worker genesis config.
|
|
52
|
+
* Used when the parent identifies a subtask worth parallelizing.
|
|
53
|
+
*/
|
|
54
|
+
export function generateWorkerGenesis(identity, config, task, workerName) {
|
|
55
|
+
const genesisPrompt = `You are a specialized worker agent created by ${config.name}.
|
|
56
|
+
|
|
57
|
+
--- YOUR TASK ---
|
|
58
|
+
${task}
|
|
59
|
+
--- END TASK ---
|
|
60
|
+
|
|
61
|
+
When your task is complete, report back to your parent (${identity.address}).
|
|
62
|
+
If you run out of compute, ask your parent for funding.
|
|
63
|
+
Be efficient -- complete the task and go to sleep.`;
|
|
64
|
+
return {
|
|
65
|
+
name: workerName,
|
|
66
|
+
genesisPrompt,
|
|
67
|
+
creatorMessage: `Complete this task: ${task}`,
|
|
68
|
+
creatorAddress: identity.address,
|
|
69
|
+
parentAddress: identity.address,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=genesis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genesis.js","sourceRoot":"","sources":["../../src/replication/genesis.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAA2B,EAC3B,MAAuB,EACvB,MAIC;IAED,0EAA0E;IAC1E,IAAI,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;IAEzC,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,aAAa,GAAG,GAAG,aAAa,wFAAwF,MAAM,CAAC,cAAc,8BAA8B,CAAC;IAC9K,CAAC;IAED,qBAAqB;IACrB,aAAa,IAAI,4CAA4C,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,OAAO,2FAA2F,CAAC;IAEzL,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,aAAa;QACb,cAAc,EAAE,MAAM,CAAC,OAAO;QAC9B,cAAc,EAAE,QAAQ,CAAC,OAAO;QAChC,aAAa,EAAE,QAAQ,CAAC,OAAO;KAChC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAA2B,EAC3B,MAAuB,EACvB,EAAqB;IAErB,MAAM,MAAM,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,GAAG,MAAM,CAAC,aAAa;;;sBAGzB,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,OAAO;;;wBAG9B,UAAU,IAAI,MAAM;yBACnB,MAAM,CAAC,cAAc;6BACjB,CAAC;IAE5B,OAAO;QACL,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,SAAS;QAC7B,aAAa;QACb,cAAc,EAAE,uBAAuB,MAAM,CAAC,IAAI,uBAAuB;QACzE,cAAc,EAAE,QAAQ,CAAC,OAAO;QAChC,aAAa,EAAE,QAAQ,CAAC,OAAO;KAChC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAA2B,EAC3B,MAAuB,EACvB,IAAY,EACZ,UAAkB;IAElB,MAAM,aAAa,GAAG,iDAAiD,MAAM,CAAC,IAAI;;;EAGlF,IAAI;;;0DAGoD,QAAQ,CAAC,OAAO;;mDAEvB,CAAC;IAElD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,aAAa;QACb,cAAc,EAAE,uBAAuB,IAAI,EAAE;QAC7C,cAAc,EAAE,QAAQ,CAAC,OAAO;QAChC,aAAa,EAAE,QAAQ,CAAC,OAAO;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lineage Tracking
|
|
3
|
+
*
|
|
4
|
+
* Track parent-child relationships between automatons.
|
|
5
|
+
* The parent records children in SQLite.
|
|
6
|
+
* Children record their parent in config.
|
|
7
|
+
* ERC-8004 registration includes parentAgent field.
|
|
8
|
+
*/
|
|
9
|
+
import type { AutomatonDatabase, ChildAutomaton, AutomatonConfig, ClawdRuntimeClient } from "../types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Get the full lineage tree (parent -> children).
|
|
12
|
+
*/
|
|
13
|
+
export declare function getLineage(db: AutomatonDatabase): {
|
|
14
|
+
children: ChildAutomaton[];
|
|
15
|
+
alive: number;
|
|
16
|
+
dead: number;
|
|
17
|
+
total: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Check if this automaton has a parent (is itself a child).
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasParent(config: AutomatonConfig): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get a summary of the lineage for the system prompt.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getLineageSummary(db: AutomatonDatabase, config: AutomatonConfig): string;
|
|
27
|
+
/**
|
|
28
|
+
* Prune dead children from tracking (optional cleanup).
|
|
29
|
+
*/
|
|
30
|
+
export declare function pruneDeadChildren(db: AutomatonDatabase, keepLast?: number): number;
|
|
31
|
+
/**
|
|
32
|
+
* Refresh status of all children.
|
|
33
|
+
*/
|
|
34
|
+
export declare function refreshChildrenStatus(runtime: ClawdRuntimeClient, db: AutomatonDatabase): Promise<void>;
|
|
35
|
+
//# sourceMappingURL=lineage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineage.d.ts","sourceRoot":"","sources":["../../src/replication/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,iBAAiB,GAAG;IACjD,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAaA;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,iBAAiB,EACrB,MAAM,EAAE,eAAe,GACtB,MAAM,CAoBR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,iBAAiB,EACrB,QAAQ,GAAE,MAAU,GACnB,MAAM,CAkBR;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,iBAAiB,GACpB,OAAO,CAAC,IAAI,CAAC,CAaf"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lineage Tracking
|
|
3
|
+
*
|
|
4
|
+
* Track parent-child relationships between automatons.
|
|
5
|
+
* The parent records children in SQLite.
|
|
6
|
+
* Children record their parent in config.
|
|
7
|
+
* ERC-8004 registration includes parentAgent field.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Get the full lineage tree (parent -> children).
|
|
11
|
+
*/
|
|
12
|
+
export function getLineage(db) {
|
|
13
|
+
const children = db.getChildren();
|
|
14
|
+
const alive = children.filter((c) => c.status === "running" || c.status === "sleeping").length;
|
|
15
|
+
const dead = children.filter((c) => c.status === "dead").length;
|
|
16
|
+
return {
|
|
17
|
+
children,
|
|
18
|
+
alive,
|
|
19
|
+
dead,
|
|
20
|
+
total: children.length,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if this automaton has a parent (is itself a child).
|
|
25
|
+
*/
|
|
26
|
+
export function hasParent(config) {
|
|
27
|
+
return !!config.parentAddress;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get a summary of the lineage for the system prompt.
|
|
31
|
+
*/
|
|
32
|
+
export function getLineageSummary(db, config) {
|
|
33
|
+
const lineage = getLineage(db);
|
|
34
|
+
const parts = [];
|
|
35
|
+
if (hasParent(config)) {
|
|
36
|
+
parts.push(`Parent: ${config.parentAddress}`);
|
|
37
|
+
}
|
|
38
|
+
if (lineage.total > 0) {
|
|
39
|
+
parts.push(`Children: ${lineage.total} total (${lineage.alive} alive, ${lineage.dead} dead)`);
|
|
40
|
+
for (const child of lineage.children) {
|
|
41
|
+
parts.push(` - ${child.name} [${child.status}] sandbox:${child.sandboxId}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return parts.length > 0 ? parts.join("\n") : "No lineage (first generation)";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Prune dead children from tracking (optional cleanup).
|
|
48
|
+
*/
|
|
49
|
+
export function pruneDeadChildren(db, keepLast = 5) {
|
|
50
|
+
const children = db.getChildren();
|
|
51
|
+
const dead = children.filter((c) => c.status === "dead");
|
|
52
|
+
if (dead.length <= keepLast)
|
|
53
|
+
return 0;
|
|
54
|
+
// Sort by creation date, oldest first
|
|
55
|
+
dead.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
|
|
56
|
+
// Keep the most recent `keepLast` dead children
|
|
57
|
+
const toRemove = dead.slice(0, dead.length - keepLast);
|
|
58
|
+
// We don't actually delete from DB -- just mark the records
|
|
59
|
+
// The DB retains all history for audit purposes
|
|
60
|
+
return toRemove.length;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Refresh status of all children.
|
|
64
|
+
*/
|
|
65
|
+
export async function refreshChildrenStatus(runtime, db) {
|
|
66
|
+
const { checkChildStatus } = await import("./spawn.js");
|
|
67
|
+
const children = db.getChildren();
|
|
68
|
+
for (const child of children) {
|
|
69
|
+
if (child.status === "dead")
|
|
70
|
+
continue;
|
|
71
|
+
try {
|
|
72
|
+
await checkChildStatus(runtime, db, child.id);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
db.updateChildStatus(child.id, "unknown");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=lineage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineage.js","sourceRoot":"","sources":["../../src/replication/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,EAAqB;IAM9C,MAAM,QAAQ,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAC3B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,KAAK,UAAU,CACzD,CAAC,MAAM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 -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spawn
|
|
3
|
+
*
|
|
4
|
+
* Spawn child automatons in new CLAWD sandboxes.
|
|
5
|
+
* The parent creates a new sandbox, installs the runtime,
|
|
6
|
+
* writes a genesis config, funds the child, and starts it.
|
|
7
|
+
*/
|
|
8
|
+
import type { ClawdRuntimeClient, AutomatonIdentity, AutomatonDatabase, ChildAutomaton, GenesisConfig } from "../types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Spawn a child automaton in a new CLAWD sandbox.
|
|
11
|
+
*/
|
|
12
|
+
export declare function spawnChild(runtime: ClawdRuntimeClient, identity: AutomatonIdentity, db: AutomatonDatabase, genesis: GenesisConfig): Promise<ChildAutomaton>;
|
|
13
|
+
/**
|
|
14
|
+
* Start a child automaton after setup.
|
|
15
|
+
*/
|
|
16
|
+
export declare function startChild(runtime: ClawdRuntimeClient, db: AutomatonDatabase, childId: string): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Check a child's status.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkChildStatus(runtime: ClawdRuntimeClient, db: AutomatonDatabase, childId: string): Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Send a message to a child automaton.
|
|
23
|
+
*/
|
|
24
|
+
export declare function messageChild(runtime: ClawdRuntimeClient, db: AutomatonDatabase, childId: string, message: string): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=spawn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/replication/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,iBAAiB,EAC3B,EAAE,EAAE,iBAAiB,EACrB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,cAAc,CAAC,CAgGzB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,iBAAiB,EACrB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,iBAAiB,EACrB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CA4BjB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,iBAAiB,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spawn
|
|
3
|
+
*
|
|
4
|
+
* Spawn child automatons in new CLAWD sandboxes.
|
|
5
|
+
* The parent creates a new sandbox, installs the runtime,
|
|
6
|
+
* writes a genesis config, funds the child, and starts it.
|
|
7
|
+
*/
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
import pathLib from "path";
|
|
10
|
+
import { MAX_CHILDREN } from "../types.js";
|
|
11
|
+
import { ulid } from "ulid";
|
|
12
|
+
/**
|
|
13
|
+
* Spawn a child automaton in a new CLAWD sandbox.
|
|
14
|
+
*/
|
|
15
|
+
export async function spawnChild(runtime, identity, db, genesis) {
|
|
16
|
+
// Check child limit
|
|
17
|
+
const existing = db.getChildren().filter((c) => c.status !== "dead");
|
|
18
|
+
if (existing.length >= MAX_CHILDREN) {
|
|
19
|
+
throw new Error(`Cannot spawn: already at max children (${MAX_CHILDREN}). Kill or wait for existing children to die.`);
|
|
20
|
+
}
|
|
21
|
+
const childId = ulid();
|
|
22
|
+
// 1. Create a new sandbox for the child
|
|
23
|
+
const sandbox = await runtime.createSandbox({
|
|
24
|
+
name: `automaton-child-${genesis.name.toLowerCase().replace(/\s+/g, "-")}`,
|
|
25
|
+
vcpu: 1,
|
|
26
|
+
memoryMb: 512,
|
|
27
|
+
diskGb: 5,
|
|
28
|
+
});
|
|
29
|
+
const child = {
|
|
30
|
+
id: childId,
|
|
31
|
+
name: genesis.name,
|
|
32
|
+
address: "0x0000000000000000000000000000000000000000", // Will be set after keygen
|
|
33
|
+
sandboxId: sandbox.id,
|
|
34
|
+
genesisPrompt: genesis.genesisPrompt,
|
|
35
|
+
creatorMessage: genesis.creatorMessage,
|
|
36
|
+
fundedAmountCents: 0,
|
|
37
|
+
status: "spawning",
|
|
38
|
+
createdAt: new Date().toISOString(),
|
|
39
|
+
};
|
|
40
|
+
db.insertChild(child);
|
|
41
|
+
// 2. Install Node.js and the automaton runtime in the child sandbox
|
|
42
|
+
await execInSandbox(runtime, sandbox.id, "apt-get update -qq && apt-get install -y -qq nodejs npm git curl", 120000);
|
|
43
|
+
// 3. Install the automaton runtime
|
|
44
|
+
await execInSandbox(runtime, sandbox.id, "npm install -g @clawd/automaton@latest 2>/dev/null || true", 60000);
|
|
45
|
+
// 4. Write the genesis configuration
|
|
46
|
+
const genesisJson = JSON.stringify({
|
|
47
|
+
name: genesis.name,
|
|
48
|
+
genesisPrompt: genesis.genesisPrompt,
|
|
49
|
+
creatorMessage: genesis.creatorMessage,
|
|
50
|
+
creatorAddress: identity.address, // Parent is the creator
|
|
51
|
+
parentAddress: identity.address,
|
|
52
|
+
}, null, 2);
|
|
53
|
+
await writeInSandbox(runtime, sandbox.id, "/root/.automaton/genesis.json", genesisJson);
|
|
54
|
+
// 4b. Propagate constitution (immutable, inherited before anything else)
|
|
55
|
+
const constitutionPath = pathLib.join(process.env.HOME || "/root", ".automaton", "constitution.md");
|
|
56
|
+
try {
|
|
57
|
+
const constitution = fs.readFileSync(constitutionPath, "utf-8");
|
|
58
|
+
await writeInSandbox(runtime, sandbox.id, "/root/.automaton/constitution.md", constitution);
|
|
59
|
+
// Make it read-only in the child
|
|
60
|
+
await execInSandbox(runtime, sandbox.id, "chmod 444 /root/.automaton/constitution.md", 5000);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Constitution file not found locally — child will get it from the repo on build
|
|
64
|
+
}
|
|
65
|
+
// 5. Record the spawn
|
|
66
|
+
db.insertModification({
|
|
67
|
+
id: ulid(),
|
|
68
|
+
timestamp: new Date().toISOString(),
|
|
69
|
+
type: "child_spawn",
|
|
70
|
+
description: `Spawned child: ${genesis.name} in sandbox ${sandbox.id}`,
|
|
71
|
+
reversible: false,
|
|
72
|
+
});
|
|
73
|
+
return child;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Start a child automaton after setup.
|
|
77
|
+
*/
|
|
78
|
+
export async function startChild(runtime, db, childId) {
|
|
79
|
+
const child = db.getChildById(childId);
|
|
80
|
+
if (!child)
|
|
81
|
+
throw new Error(`Child ${childId} not found`);
|
|
82
|
+
// Initialize wallet, provision, and run
|
|
83
|
+
await execInSandbox(runtime, child.sandboxId, "automaton --init && automaton --provision && systemctl start automaton 2>/dev/null || automaton --run &", 60000);
|
|
84
|
+
db.updateChildStatus(childId, "running");
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Check a child's status.
|
|
88
|
+
*/
|
|
89
|
+
export async function checkChildStatus(runtime, db, childId) {
|
|
90
|
+
const child = db.getChildById(childId);
|
|
91
|
+
if (!child)
|
|
92
|
+
throw new Error(`Child ${childId} not found`);
|
|
93
|
+
try {
|
|
94
|
+
const result = await execInSandbox(runtime, child.sandboxId, "automaton --status 2>/dev/null || echo 'offline'", 10000);
|
|
95
|
+
const output = result.stdout || "unknown";
|
|
96
|
+
// Parse status from output
|
|
97
|
+
if (output.includes("dead")) {
|
|
98
|
+
db.updateChildStatus(childId, "dead");
|
|
99
|
+
}
|
|
100
|
+
else if (output.includes("sleeping")) {
|
|
101
|
+
db.updateChildStatus(childId, "sleeping");
|
|
102
|
+
}
|
|
103
|
+
else if (output.includes("running")) {
|
|
104
|
+
db.updateChildStatus(childId, "running");
|
|
105
|
+
}
|
|
106
|
+
return output;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
db.updateChildStatus(childId, "unknown");
|
|
110
|
+
return "Unable to reach child sandbox";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Send a message to a child automaton.
|
|
115
|
+
*/
|
|
116
|
+
export async function messageChild(runtime, db, childId, message) {
|
|
117
|
+
const child = db.getChildById(childId);
|
|
118
|
+
if (!child)
|
|
119
|
+
throw new Error(`Child ${childId} not found`);
|
|
120
|
+
// Write message to child's message queue
|
|
121
|
+
const msgJson = JSON.stringify({
|
|
122
|
+
from: "parent",
|
|
123
|
+
content: message,
|
|
124
|
+
timestamp: new Date().toISOString(),
|
|
125
|
+
});
|
|
126
|
+
await writeInSandbox(runtime, child.sandboxId, `/root/.automaton/inbox/${ulid()}.json`, msgJson);
|
|
127
|
+
}
|
|
128
|
+
// ─── Helpers ──────────────────────────────────────────────────
|
|
129
|
+
async function execInSandbox(runtime, sandboxId, command, timeout = 30000) {
|
|
130
|
+
// Use the CLAWD Runtime API to exec in a specific sandbox
|
|
131
|
+
const apiUrl = runtime.__apiUrl || "https://api.x402.wtf";
|
|
132
|
+
const apiKey = runtime.__apiKey || "";
|
|
133
|
+
const resp = await fetch(`${apiUrl}/v1/sandboxes/${sandboxId}/exec`, {
|
|
134
|
+
method: "POST",
|
|
135
|
+
headers: {
|
|
136
|
+
"Content-Type": "application/json",
|
|
137
|
+
Authorization: apiKey,
|
|
138
|
+
},
|
|
139
|
+
body: JSON.stringify({ command, timeout }),
|
|
140
|
+
});
|
|
141
|
+
if (!resp.ok) {
|
|
142
|
+
const text = await resp.text();
|
|
143
|
+
throw new Error(`Exec in sandbox ${sandboxId} failed: ${text}`);
|
|
144
|
+
}
|
|
145
|
+
return resp.json();
|
|
146
|
+
}
|
|
147
|
+
async function writeInSandbox(runtime, sandboxId, path, content) {
|
|
148
|
+
const apiUrl = runtime.__apiUrl || "https://api.x402.wtf";
|
|
149
|
+
const apiKey = runtime.__apiKey || "";
|
|
150
|
+
// Ensure parent directory exists
|
|
151
|
+
const dir = path.substring(0, path.lastIndexOf("/"));
|
|
152
|
+
await execInSandbox(runtime, sandboxId, `mkdir -p ${dir}`, 5000);
|
|
153
|
+
const resp = await fetch(`${apiUrl}/v1/sandboxes/${sandboxId}/files/upload/json`, {
|
|
154
|
+
method: "POST",
|
|
155
|
+
headers: {
|
|
156
|
+
"Content-Type": "application/json",
|
|
157
|
+
Authorization: apiKey,
|
|
158
|
+
},
|
|
159
|
+
body: JSON.stringify({ path, content }),
|
|
160
|
+
});
|
|
161
|
+
if (!resp.ok) {
|
|
162
|
+
const text = await resp.text();
|
|
163
|
+
throw new Error(`Write to sandbox ${sandboxId} failed: ${text}`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=spawn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../src/replication/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,OAAO,MAAM,MAAM,CAAC;AAQ3B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAA2B,EAC3B,QAA2B,EAC3B,EAAqB,EACrB,OAAsB;IAEtB,oBAAoB;IACpB,MAAM,QAAQ,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,MAAM,CACtC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAC3B,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,IAAI,YAAY,EAAE,CAAC;QACpC,MA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C;AAED,KAAK,UAAU,cAAc,CAC3B,OAA2B,EAC3B,SAAiB,EACjB,IAAY,EACZ,OAAe;IAEf,MAAM,MAAM,GAAI,OAAe,CAAC,QAAQ,IAAI,sBAAsB,CAAC;IACnE,MAAM,MAAM,GAAI,OAAe,CAAC,QAAQ,IAAI,EAAE,CAAC;IAE/C,iCAAiC;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,MAAM,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;IAEjE,MAAM,IAAI,GAAG,MAAM,KAAK,CACtB,GAAG,MAAM,iBAAiB,SAAS,oBAAoB,EACvD;QACE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,MAAM;SACtB;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KACxC,CACF,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,oBAAoB,SAAS,YAAY,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit Log
|
|
3
|
+
*
|
|
4
|
+
* Immutable append-only log of all self-modifications.
|
|
5
|
+
* The creator can see everything the automaton changes about itself.
|
|
6
|
+
*/
|
|
7
|
+
import type { AutomatonDatabase, ModificationEntry, ModificationType } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Log a self-modification to the audit trail.
|
|
10
|
+
*/
|
|
11
|
+
export declare function logModification(db: AutomatonDatabase, type: ModificationType, description: string, options?: {
|
|
12
|
+
filePath?: string;
|
|
13
|
+
diff?: string;
|
|
14
|
+
reversible?: boolean;
|
|
15
|
+
}): ModificationEntry;
|
|
16
|
+
/**
|
|
17
|
+
* Get recent modifications for display or context.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getRecentModifications(db: AutomatonDatabase, limit?: number): ModificationEntry[];
|
|
20
|
+
/**
|
|
21
|
+
* Generate a summary of all modifications for the creator.
|
|
22
|
+
*/
|
|
23
|
+
export declare function generateAuditReport(db: AutomatonDatabase): string;
|
|
24
|
+
//# sourceMappingURL=audit-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../../src/self-mod/audit-log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAGrB;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,iBAAiB,EACrB,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GACA,iBAAiB,CAanB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,iBAAiB,EACrB,KAAK,GAAE,MAAW,GACjB,iBAAiB,EAAE,CAErB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,iBAAiB,GACpB,MAAM,CAqBR"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit Log
|
|
3
|
+
*
|
|
4
|
+
* Immutable append-only log of all self-modifications.
|
|
5
|
+
* The creator can see everything the automaton changes about itself.
|
|
6
|
+
*/
|
|
7
|
+
import { ulid } from "ulid";
|
|
8
|
+
/**
|
|
9
|
+
* Log a self-modification to the audit trail.
|
|
10
|
+
*/
|
|
11
|
+
export function logModification(db, type, description, options) {
|
|
12
|
+
const entry = {
|
|
13
|
+
id: ulid(),
|
|
14
|
+
timestamp: new Date().toISOString(),
|
|
15
|
+
type,
|
|
16
|
+
description,
|
|
17
|
+
filePath: options?.filePath,
|
|
18
|
+
diff: options?.diff,
|
|
19
|
+
reversible: options?.reversible ?? true,
|
|
20
|
+
};
|
|
21
|
+
db.insertModification(entry);
|
|
22
|
+
return entry;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get recent modifications for display or context.
|
|
26
|
+
*/
|
|
27
|
+
export function getRecentModifications(db, limit = 20) {
|
|
28
|
+
return db.getRecentModifications(limit);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generate a summary of all modifications for the creator.
|
|
32
|
+
*/
|
|
33
|
+
export function generateAuditReport(db) {
|
|
34
|
+
const mods = db.getRecentModifications(100);
|
|
35
|
+
if (mods.length === 0) {
|
|
36
|
+
return "No self-modifications recorded.";
|
|
37
|
+
}
|
|
38
|
+
const lines = [
|
|
39
|
+
`=== SELF-MODIFICATION AUDIT LOG ===`,
|
|
40
|
+
`Total modifications: ${mods.length}`,
|
|
41
|
+
``,
|
|
42
|
+
];
|
|
43
|
+
for (const mod of mods) {
|
|
44
|
+
lines.push(`[${mod.timestamp}] ${mod.type}: ${mod.description}${mod.filePath ? ` (${mod.filePath})` : ""}`);
|
|
45
|
+
}
|
|
46
|
+
lines.push(`=================================`);
|
|
47
|
+
return lines.join("\n");
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=audit-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.js","sourceRoot":"","sources":["../../src/self-mod/audit-log.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,UAA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AAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-Modification Engine
|
|
3
|
+
*
|
|
4
|
+
* Allows the automaton to edit its own code and configuration.
|
|
5
|
+
* All changes are audited, rate-limited, and some paths are protected.
|
|
6
|
+
*
|
|
7
|
+
* Safety model inspired by nanoclaw's trust boundary architecture:
|
|
8
|
+
* - Hard-coded invariants that can NEVER be modified by the agent
|
|
9
|
+
* - The safety enforcement code is immutable from the agent's perspective
|
|
10
|
+
* - Pre-modification snapshots via git
|
|
11
|
+
* - Rate limiting on modification frequency
|
|
12
|
+
* - Symlink resolution before path validation
|
|
13
|
+
* - Maximum diff size enforcement
|
|
14
|
+
*/
|
|
15
|
+
import type { ClawdRuntimeClient, AutomatonDatabase } from "../types.js";
|
|
16
|
+
/**
|
|
17
|
+
* Check if a file path is protected from modification.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isProtectedFile(filePath: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Edit a file in the automaton's environment.
|
|
22
|
+
* Records the change in the audit log.
|
|
23
|
+
* Commits a git snapshot before modification.
|
|
24
|
+
*
|
|
25
|
+
* Safety checks:
|
|
26
|
+
* 1. Protected file check (hard-coded invariant)
|
|
27
|
+
* 2. Blocked directory check
|
|
28
|
+
* 3. Path traversal check (symlink resolution)
|
|
29
|
+
* 4. Rate limiting
|
|
30
|
+
* 5. File size limit
|
|
31
|
+
* 6. Pre-modification git snapshot
|
|
32
|
+
* 7. Audit log entry
|
|
33
|
+
*/
|
|
34
|
+
export declare function editFile(runtime: ClawdRuntimeClient, db: AutomatonDatabase, filePath: string, newContent: string, reason: string): Promise<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
error?: string;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Validate a proposed modification without executing it.
|
|
40
|
+
* Returns safety analysis results.
|
|
41
|
+
*/
|
|
42
|
+
export declare function validateModification(db: AutomatonDatabase, filePath: string, contentSize: number): {
|
|
43
|
+
allowed: boolean;
|
|
44
|
+
reason: string;
|
|
45
|
+
checks: {
|
|
46
|
+
name: string;
|
|
47
|
+
passed: boolean;
|
|
48
|
+
detail: string;
|
|
49
|
+
}[];
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.d.ts","sourceRoot":"","sources":["../../src/self-mod/code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAiHrB;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAkBzD;AAmBD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,iBAAiB,EACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA8E/C;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,iBAAiB,EACrB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC7D,CAqDA"}
|