@0gfoundation/0g-agentdna 0.2.1 → 0.2.3
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/GUIDE.md +67 -18
- package/MIGRATION.md +8 -0
- package/MIGRATION.zh.md +5 -0
- package/PROVIDERS.md +6 -4
- package/PROVIDERS.zh.md +4 -3
- package/README.md +20 -4
- package/dist/AgentClient.d.ts +175 -2
- package/dist/AgentClient.d.ts.map +1 -1
- package/dist/AgentClient.js +166 -7
- package/dist/AgentClient.js.map +1 -1
- package/dist/AgenticID.d.ts +47 -7
- package/dist/AgenticID.d.ts.map +1 -1
- package/dist/AgenticID.js +44 -13
- package/dist/AgenticID.js.map +1 -1
- package/dist/AgenticIDClient.d.ts +1 -1
- package/dist/AgenticIDClient.js +1 -1
- package/dist/AttestorClient.d.ts +67 -2
- package/dist/AttestorClient.d.ts.map +1 -1
- package/dist/AttestorClient.js +162 -33
- package/dist/AttestorClient.js.map +1 -1
- package/dist/ReputationClient.d.ts +1 -1
- package/dist/ReputationClient.js +1 -1
- package/dist/SandboxClient.d.ts +1 -1
- package/dist/SandboxClient.js +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +8 -2
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/interactive.d.ts +71 -2
- package/dist/cli/commands/interactive.d.ts.map +1 -1
- package/dist/cli/commands/interactive.js +423 -46
- package/dist/cli/commands/interactive.js.map +1 -1
- package/dist/cli/commands/settings.d.ts.map +1 -1
- package/dist/cli/commands/settings.js +23 -0
- package/dist/cli/commands/settings.js.map +1 -1
- package/dist/cli/config.d.ts +10 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +38 -0
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/env.js +1 -1
- package/dist/cli/env.js.map +1 -1
- package/dist/cli/inference.d.ts +25 -0
- package/dist/cli/inference.d.ts.map +1 -1
- package/dist/cli/inference.js +67 -6
- package/dist/cli/inference.js.map +1 -1
- package/dist/cli/main.js +12 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/sdk.d.ts +1 -1
- package/dist/cli/sdk.js +1 -1
- package/dist/cli/settings.d.ts +20 -0
- package/dist/cli/settings.d.ts.map +1 -1
- package/dist/cli/settings.js +40 -1
- package/dist/cli/settings.js.map +1 -1
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +2 -2
- package/dist/context.d.ts +2 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/secretEnv.js +1 -1
- package/dist/secretEnv.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/src/AgentClient.ts +326 -9
- package/src/AgenticID.ts +66 -11
- package/src/AgenticIDClient.ts +1 -1
- package/src/AttestorClient.ts +207 -51
- package/src/ReputationClient.ts +1 -1
- package/src/SandboxClient.ts +1 -1
- package/src/cli/commands/doctor.ts +8 -2
- package/src/cli/commands/interactive.ts +405 -51
- package/src/cli/commands/settings.ts +22 -1
- package/src/cli/config.ts +36 -0
- package/src/cli/env.ts +1 -1
- package/src/cli/inference.ts +82 -5
- package/src/cli/main.ts +13 -3
- package/src/cli/sdk.ts +1 -1
- package/src/cli/settings.ts +41 -0
- package/src/constants.ts +3 -3
- package/src/context.ts +2 -2
- package/src/index.ts +7 -3
- package/src/secretEnv.ts +1 -1
- package/src/types.ts +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file context.ts
|
|
3
|
-
* @description Shared config + runtime context for the
|
|
3
|
+
* @description Shared config + runtime context for the AgentDNA facade and its
|
|
4
4
|
* internal per-contract clients. Constructed once; passed to each sub-client.
|
|
5
5
|
*/
|
|
6
6
|
import { type Account, type Chain, type PublicClient, type WalletClient } from 'viem';
|
|
7
7
|
import { type ContractAddresses } from './constants';
|
|
8
|
-
/** Public config for `new
|
|
8
|
+
/** Public config for `new AgentDNA(config)` (exported as `AgentDNAConfig`). */
|
|
9
9
|
export interface AgenticIDConfig {
|
|
10
10
|
/** RPC endpoint. Defaults to the 0G Galileo testnet RPC. */
|
|
11
11
|
rpcUrl?: string;
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9E
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,MAAM,CAAC;AAEd,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9E,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,8FAA8F;IAC9F,SAAS,EAAE,iBAAiB,CAAC;IAC7B,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,KAAK,MAAM,EAAE,CAAC;IAClC;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;;;;;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AE,KAAK,CAAC;IACb,SAAS,EAAE,iBAAiB,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B;mEAC+D;IAC/D,uBAAuB,EAAE,OAAO,CAAC;IACjC;;;;2EAIuE;IACvE,cAAc,EAAE,MAAM,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAC3D,gDAAgD;IAChD,YAAY,CAAC,EAAE;QACb,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACnD,CAAC;CACH;AAID,wBAAgB,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,GAAG,CA2CrD;AAED,mCAAmC;AACnC,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,YAAY,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAKxF"}
|
package/dist/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @file context.ts
|
|
4
|
-
* @description Shared config + runtime context for the
|
|
4
|
+
* @description Shared config + runtime context for the AgentDNA facade and its
|
|
5
5
|
* internal per-contract clients. Constructed once; passed to each sub-client.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/index.d.ts
CHANGED
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
export { AgenticID as AgentDNA, AgenticID, AgentApi, AdminApi, ReputationApi } from './AgenticID';
|
|
17
|
-
export type { DeployAccepted, WaitLevel } from './AgenticID';
|
|
17
|
+
export type { ContainerStatus, DeployAccepted, WaitLevel } from './AgenticID';
|
|
18
18
|
export { makeAgentClient } from './AgentClient';
|
|
19
|
-
export type { AgentClient, AgentServiceEntry, AgentRoute, ChatMessage, ChatCompletion, AgentTask } from './AgentClient';
|
|
19
|
+
export type { AgentClient, AgentServiceEntry, AgentRoute, ChatMessage, ChatCompletion, AgentTask, AgentTaskInfo, AgentTaskStop, AgentInbox, AgentInboxMessage, AgentSchedule, AgentEvent, } from './AgentClient';
|
|
20
20
|
export { mcpServices } from './AgentClient';
|
|
21
|
-
export { defaultIData } from './AttestorClient';
|
|
21
|
+
export { defaultIData, DEFAULT_PERSONA_INFERENCE, deploymentFactsOf, needsDefaultSettings, storeDefaultSettings } from './AttestorClient';
|
|
22
|
+
export type { DeploymentFacts } from './AttestorClient';
|
|
22
23
|
export type { DefaultIDataParams } from './AttestorClient';
|
|
23
24
|
export type { AgenticIDConfig as AgentDNAConfig, AgenticIDConfig } from './context';
|
|
24
25
|
export { SandboxClient } from './SandboxClient';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClG,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClG,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EACV,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* ```
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
19
|
-
exports.routeHash = exports.inferenceProvider = exports.listInferenceProviders = exports.sandboxServingAbi = exports.tappRegistryAbi = exports.feedbackBatcherAbi = exports.verifiedFeedbackAbi = exports.canonicalReputationAbi = exports.standardCloneAuthorizerAbi = exports.cloneGateAbi = exports.agenticIDAbi = exports.RECEIPT_WAIT = exports.CHAIN_ID = void 0;
|
|
18
|
+
exports.requestUriOf = exports.taskHashOf = exports.verifyServeProofSignature = exports.signServeProof = exports.buildServeProof = exports.buildServeProofSigningHash = exports.buildServeProofMessageHash = exports.proofRecordingFetch = exports.taskRevealOf = exports.captureProof = exports.proofFromResponse = exports.parseServeProofHeader = exports.SERVE_PROOF_HEADER = exports.ServeSession = exports.fetchRouterModelIds = exports.modelAdvisory = exports.sha256Hex = exports.SettingsConflictError = exports.settingsAuthMessage = exports.canonicalSettings = exports.ROUTER_MODELS_URL = exports.ZG_COMPUTE_PROVIDER = exports.SETTINGS_FIELDS = exports.THINKING_LEVELS = exports.SETTINGS_DOMAIN = exports.sealSecretEnv = exports.SecretEnvRefusedError = exports.SECRET_ENV_VAR = exports.SECRET_ENV_SCHEME = exports.b64encode = exports.DEPLOY_DOMAIN = exports.CLONE_CONTRACT_DOMAIN = exports.CLONE_DOMAIN = exports.AttestorClient = exports.MAX_ABS_FEEDBACK_VALUE = exports.ReputationClient = exports.AgenticIDClient = exports.SandboxClient = exports.storeDefaultSettings = exports.needsDefaultSettings = exports.deploymentFactsOf = exports.DEFAULT_PERSONA_INFERENCE = exports.defaultIData = exports.mcpServices = exports.makeAgentClient = exports.ReputationApi = exports.AdminApi = exports.AgentApi = exports.AgenticID = exports.AgentDNA = void 0;
|
|
19
|
+
exports.routeHash = exports.inferenceProvider = exports.listInferenceProviders = exports.sandboxServingAbi = exports.tappRegistryAbi = exports.feedbackBatcherAbi = exports.verifiedFeedbackAbi = exports.canonicalReputationAbi = exports.standardCloneAuthorizerAbi = exports.cloneGateAbi = exports.agenticIDAbi = exports.RECEIPT_WAIT = exports.CHAIN_ID = exports.RPC_URL = exports.ZERO_G_MAINNET = exports.ZERO_G_TESTNET = exports.requestUriCandidates = void 0;
|
|
20
20
|
// Node < 18 has no global fetch; without this guard the first bootstrap
|
|
21
21
|
// (fromAttestor) or chain read fails with a bare "fetch is not defined" from
|
|
22
22
|
// deep in the call stack. package.json `engines` isn't enforced by npm by
|
|
@@ -38,6 +38,10 @@ var AgentClient_2 = require("./AgentClient");
|
|
|
38
38
|
Object.defineProperty(exports, "mcpServices", { enumerable: true, get: function () { return AgentClient_2.mcpServices; } });
|
|
39
39
|
var AttestorClient_1 = require("./AttestorClient");
|
|
40
40
|
Object.defineProperty(exports, "defaultIData", { enumerable: true, get: function () { return AttestorClient_1.defaultIData; } });
|
|
41
|
+
Object.defineProperty(exports, "DEFAULT_PERSONA_INFERENCE", { enumerable: true, get: function () { return AttestorClient_1.DEFAULT_PERSONA_INFERENCE; } });
|
|
42
|
+
Object.defineProperty(exports, "deploymentFactsOf", { enumerable: true, get: function () { return AttestorClient_1.deploymentFactsOf; } });
|
|
43
|
+
Object.defineProperty(exports, "needsDefaultSettings", { enumerable: true, get: function () { return AttestorClient_1.needsDefaultSettings; } });
|
|
44
|
+
Object.defineProperty(exports, "storeDefaultSettings", { enumerable: true, get: function () { return AttestorClient_1.storeDefaultSettings; } });
|
|
41
45
|
// ── Namespace implementation classes (advanced / typing) ──
|
|
42
46
|
var SandboxClient_1 = require("./SandboxClient");
|
|
43
47
|
Object.defineProperty(exports, "SandboxClient", { enumerable: true, get: function () { return SandboxClient_1.SandboxClient; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,wEAAwE;AACxE,6EAA6E;AAC7E,0EAA0E;AAC1E,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AACR,yGAAA,YAAY,OAAA;AAId,8BAA8B;AAC9B,6BASe;AARb,mGAAA,YAAY,OAAA;AACZ,mGAAA,YAAY,OAAA;AACZ,iHAAA,0BAA0B,OAAA;AAC1B,6GAAA,sBAAsB,OAAA;AACtB,0GAAA,mBAAmB,OAAA;AACnB,yGAAA,kBAAkB,OAAA;AAClB,sGAAA,eAAe,OAAA;AACf,wGAAA,iBAAiB,OAAA;AAGnB,yCAAmF;AAA1E,mHAAA,sBAAsB,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AAAE,sGAAA,SAAS,OAAA"}
|
package/dist/secretEnv.js
CHANGED
|
@@ -72,7 +72,7 @@ function randomBytes(n) {
|
|
|
72
72
|
cryptoObj = require('crypto').webcrypto;
|
|
73
73
|
}
|
|
74
74
|
if (!cryptoObj?.getRandomValues) {
|
|
75
|
-
throw new Error('
|
|
75
|
+
throw new Error('AgentDNA SDK: no WebCrypto available (need a browser or Node >= 18 with crypto.webcrypto)');
|
|
76
76
|
}
|
|
77
77
|
cryptoObj.getRandomValues(a);
|
|
78
78
|
return a;
|
package/dist/secretEnv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secretEnv.js","sourceRoot":"","sources":["../src/secretEnv.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAmFH,kCAYC;AAaD,gDAGC;AAGD,oCAoBC;AAiBD,sCAcC;AAID,oDAcC;AAwBD,oDAaC;AA1ND,uDAAoD;AACpD,6CAA0C;AAC1C,6CAA4C;AAC5C,4CAAyC;AACzC,+BAAwF;AAExF,qFAAqF;AACxE,QAAA,iBAAiB,GAAG,qBAAqB,CAAC;AACvD,gEAAgE;AACnD,QAAA,cAAc,GAAG,iBAAiB,CAAC;AAkDhD;;;;GAIG;AACH,MAAa,qBAAsB,SAAQ,KAAK;IAE9C,YACW,IAA0B,EACnC,OAAe,EACf,OAA6B;QAE7B,KAAK,CAAC,OAAO,CA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C7B,IAAI,qBAAqB,CAAC,2BAA2B,EAAE,mBAAmB,GAAG,sCAAsC,CAAC,CAAC;IACvH,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC1G,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,GAAG,CAAC,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,aAAa,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;QAAE,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;IAC7G,IAAI,CAAC;QACH,qBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,MAAM,CAAC,kDAAkD,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file types.ts
|
|
3
|
-
* @description All TypeScript types for the 0G
|
|
3
|
+
* @description All TypeScript types for the 0G AgentDNA SDK, mirroring the Solidity structs and enums.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Oracle type for ownership proofs.
|
package/dist/types.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @file types.ts
|
|
4
|
-
* @description All TypeScript types for the 0G
|
|
4
|
+
* @description All TypeScript types for the 0G AgentDNA SDK, mirroring the Solidity structs and enums.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.OracleType = void 0;
|
package/package.json
CHANGED
package/src/AgentClient.ts
CHANGED
|
@@ -138,6 +138,120 @@ export interface ChatCompletion {
|
|
|
138
138
|
[k: string]: unknown;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* One unit of work on the agent, as its task list shows it
|
|
143
|
+
* ({@link AgentClient.tasks}): a turn of its conversation, a background
|
|
144
|
+
* command, or a subagent. `actor` says who does the work, `trigger` who asked
|
|
145
|
+
* for it.
|
|
146
|
+
*/
|
|
147
|
+
export interface AgentTaskInfo {
|
|
148
|
+
/** A turn: `resp_…` (the id {@link AgentClient.task} and
|
|
149
|
+
* {@link AgentClient.followTask} take). A command: `bash-N`. A subagent:
|
|
150
|
+
* `subagent-N`. */
|
|
151
|
+
id: string;
|
|
152
|
+
type: 'turn' | 'command' | 'subagent';
|
|
153
|
+
status: AgentTask['status'];
|
|
154
|
+
/** Who does the work: `agent` (the main agent) or `subagent`. */
|
|
155
|
+
actor: 'agent' | 'subagent';
|
|
156
|
+
/** Who asked. A turn: `user` | `job` | `schedule` | `plugin`. A command or
|
|
157
|
+
* a subagent: `agent` (the main agent started it). */
|
|
158
|
+
trigger: string;
|
|
159
|
+
/** What the task is: the prompt, the job notice, the reminder's text. */
|
|
160
|
+
label: string;
|
|
161
|
+
/** Unix seconds. */
|
|
162
|
+
created_at: number;
|
|
163
|
+
started_at?: number;
|
|
164
|
+
finished_at?: number;
|
|
165
|
+
error?: string;
|
|
166
|
+
detail?: string;
|
|
167
|
+
/** Notices that reached the agent while this turn ran, merged into it. */
|
|
168
|
+
merged_notices?: string[];
|
|
169
|
+
/** {@link AgentClient.taskInfo} only: a turn's text, or a finished
|
|
170
|
+
* subagent's final answer. A command's output is never returned. */
|
|
171
|
+
output_text?: string;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** What stopping one task did ({@link AgentClient.stopTask}). */
|
|
175
|
+
export interface AgentTaskStop {
|
|
176
|
+
id: string;
|
|
177
|
+
outcome: 'cancelled' | 'already-finished' | 'not-running';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The words of a turn the agent opened itself (a background job finished, a
|
|
182
|
+
* reminder came due), kept in the agent's inbox until the owner reads them.
|
|
183
|
+
*/
|
|
184
|
+
export interface AgentInboxMessage {
|
|
185
|
+
/** Its position in the agent's cursor: ack through it with
|
|
186
|
+
* {@link AgentClient.ackInbox}. */
|
|
187
|
+
seq: number;
|
|
188
|
+
/** The turn's id. */
|
|
189
|
+
id: string;
|
|
190
|
+
/** What opened the turn: `job` | `schedule` | `plugin`. */
|
|
191
|
+
trigger: string;
|
|
192
|
+
/** The job notice, or the reminder's text. */
|
|
193
|
+
label: string;
|
|
194
|
+
status: AgentTask['status'];
|
|
195
|
+
/** What the agent said in that turn. */
|
|
196
|
+
text: string;
|
|
197
|
+
error?: string;
|
|
198
|
+
created_at: number;
|
|
199
|
+
finished_at?: number;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** One page of the inbox ({@link AgentClient.inbox}). */
|
|
203
|
+
export interface AgentInbox {
|
|
204
|
+
data: AgentInboxMessage[];
|
|
205
|
+
/** Messages after the read position. The position is the agent's, so every
|
|
206
|
+
* client sees the same count. */
|
|
207
|
+
unread: number;
|
|
208
|
+
read_through: number;
|
|
209
|
+
/** The agent's cursor now: pass it to {@link AgentClient.events} as
|
|
210
|
+
* `after` and the feed misses nothing that happens after this read. */
|
|
211
|
+
cursor: number;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** A reminder the agent set for itself ({@link AgentClient.schedules}). */
|
|
215
|
+
export interface AgentSchedule {
|
|
216
|
+
id: string;
|
|
217
|
+
kind: 'after' | 'at' | 'every';
|
|
218
|
+
/** The reminder's own text. */
|
|
219
|
+
prompt: string;
|
|
220
|
+
afterSeconds?: number;
|
|
221
|
+
everySeconds?: number;
|
|
222
|
+
/** When it comes due next (ISO 8601). */
|
|
223
|
+
scheduledAt: string;
|
|
224
|
+
state: 'scheduled' | 'overdue';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* One event of the agent's live feed ({@link AgentClient.events}). `data` is
|
|
229
|
+
* the payload as the agent sent it (its `seq` and `time` included), by
|
|
230
|
+
* `type`:
|
|
231
|
+
*
|
|
232
|
+
* | type | data |
|
|
233
|
+
* |---|---|
|
|
234
|
+
* | `turn.queued` / `turn.started` / `turn.completed` / `turn.failed` / `turn.cancelled` | an {@link AgentTaskInfo} (a turn) |
|
|
235
|
+
* | `task.updated` | an {@link AgentTaskInfo} (a command or a subagent) |
|
|
236
|
+
* | `inbox.message` | an {@link AgentInboxMessage} |
|
|
237
|
+
* | `inbox.read` | `{ read_through }` |
|
|
238
|
+
* | `schedule.changed` | `{ operation: "create" \| "delete" \| "dispatch", id }` |
|
|
239
|
+
* | `reset` | `{ cursor, read_through }` |
|
|
240
|
+
*
|
|
241
|
+
* `reset` means the agent could not serve the position asked for (it is
|
|
242
|
+
* older than the agent's in-memory window, or from before a `/clear`):
|
|
243
|
+
* re-read the inbox, tasks and schedules; the feed carries on from `cursor`.
|
|
244
|
+
* A type this list does not name is passed through as it came.
|
|
245
|
+
*/
|
|
246
|
+
export interface AgentEvent {
|
|
247
|
+
type: string;
|
|
248
|
+
/** Its position in the agent's cursor. */
|
|
249
|
+
seq: number;
|
|
250
|
+
/** Agent clock, ms since the epoch. */
|
|
251
|
+
time: number;
|
|
252
|
+
data: Record<string, unknown>;
|
|
253
|
+
}
|
|
254
|
+
|
|
141
255
|
/**
|
|
142
256
|
* A live handle to an agent. Always carries `base` and the declared
|
|
143
257
|
* `services`/`routes`. Owner affordances (`chat`/`chatStream`) are
|
|
@@ -196,14 +310,15 @@ export interface AgentClient {
|
|
|
196
310
|
*
|
|
197
311
|
* Pass `signal` to interrupt a turn in flight: aborting tears down the HTTP
|
|
198
312
|
* connection, which is the OpenAI-conventional cancel signal — the runtime
|
|
199
|
-
* side stops the turn where the framework supports cancellation (
|
|
313
|
+
* side stops the turn where the framework supports cancellation (0g-harness
|
|
314
|
+
* does).
|
|
200
315
|
* The generator then throws the abort error (`err.name === "AbortError"`).
|
|
201
316
|
*/
|
|
202
317
|
chatStream?(messages: ChatMessage[], opts?: {
|
|
203
318
|
model?: string;
|
|
204
319
|
signal?: AbortSignal;
|
|
205
320
|
/** Tool-activity progress, when the agent's bridge streams it (SSE
|
|
206
|
-
* ": activity tool/call <name>" comments —
|
|
321
|
+
* ": activity tool/call <name>" comments — 0g-harness does). Labels like
|
|
207
322
|
* "tool/call bash", "tool/result", "turn/end". Advisory: absence just
|
|
208
323
|
* means the bridge doesn't narrate. */
|
|
209
324
|
onActivity?: (label: string) => void;
|
|
@@ -265,6 +380,55 @@ export interface AgentClient {
|
|
|
265
380
|
* `tail` to keep only the last N lines.
|
|
266
381
|
*/
|
|
267
382
|
logs?(opts?: { tail?: number }): Promise<string>;
|
|
383
|
+
/**
|
|
384
|
+
* Read the agent's inbox: the words of turns the agent opened itself (a
|
|
385
|
+
* background job finished, a reminder came due), oldest first. Without
|
|
386
|
+
* `after`, the messages after the read position; `after: 0` returns all of
|
|
387
|
+
* them. Present only when the agent declares a `kind: "inbox"` route and
|
|
388
|
+
* this handle holds the owner token.
|
|
389
|
+
*/
|
|
390
|
+
inbox?(opts?: { after?: number; limit?: number }): Promise<AgentInbox>;
|
|
391
|
+
/** Move the inbox read position forward to `through` (it never moves
|
|
392
|
+
* back). Present under the same conditions as {@link inbox}. */
|
|
393
|
+
ackInbox?(through: number): Promise<{ read_through: number; unread: number }>;
|
|
394
|
+
/**
|
|
395
|
+
* Follow the agent's live feed: turn, task, inbox and schedule changes, as
|
|
396
|
+
* they happen. Runs until `signal` aborts: a dropped or silent connection
|
|
397
|
+
* is reopened from the last event seen, so nothing is lost or repeated. Pass
|
|
398
|
+
* `after` (e.g. {@link AgentInbox.cursor}) to start from a known position;
|
|
399
|
+
* without it the feed starts at the agent's current one. Throws only on an
|
|
400
|
+
* answer that retrying cannot change (an HTTP 4xx). Present only when the
|
|
401
|
+
* agent declares a `kind: "events"` route and this handle holds the owner
|
|
402
|
+
* token.
|
|
403
|
+
*/
|
|
404
|
+
events?(opts?: { after?: number; signal?: AbortSignal }): AsyncGenerator<AgentEvent>;
|
|
405
|
+
/**
|
|
406
|
+
* Everything running or that has run on the agent, newest first: turns,
|
|
407
|
+
* background commands and subagents, with who does each (`actor`) and who
|
|
408
|
+
* asked (`trigger`). `status` filters: `"active"` (queued or running) or one
|
|
409
|
+
* status name. Present only when the agent declares a `kind: "tasks"` route
|
|
410
|
+
* and this handle holds the owner token.
|
|
411
|
+
*/
|
|
412
|
+
tasks?(opts?: { status?: string; limit?: number }): Promise<AgentTaskInfo[]>;
|
|
413
|
+
/** One task of {@link tasks}, by id, with its `output_text` where there
|
|
414
|
+
* is one. Present under the same conditions as {@link tasks}. */
|
|
415
|
+
taskInfo?(id: string): Promise<AgentTaskInfo>;
|
|
416
|
+
/**
|
|
417
|
+
* Stop one task of {@link tasks}: a turn is cancelled (a queued one never
|
|
418
|
+
* starts), a command or subagent is killed. Already-executed actions are
|
|
419
|
+
* not rolled back. Present under the same conditions as {@link tasks}.
|
|
420
|
+
*/
|
|
421
|
+
stopTask?(id: string): Promise<AgentTaskStop>;
|
|
422
|
+
/** Stop everything: queued turns first, then the running turn, then every
|
|
423
|
+
* running command and subagent. Present under the same conditions as
|
|
424
|
+
* {@link tasks}. */
|
|
425
|
+
stopAllTasks?(): Promise<AgentTaskStop[]>;
|
|
426
|
+
/**
|
|
427
|
+
* The reminders the agent set for itself. `enabled: false` means the
|
|
428
|
+
* agent's reminders are switched off. Present only when the agent declares
|
|
429
|
+
* a `kind: "schedules"` route and this handle holds the owner token.
|
|
430
|
+
*/
|
|
431
|
+
schedules?(): Promise<{ enabled: boolean; data: AgentSchedule[] }>;
|
|
268
432
|
}
|
|
269
433
|
|
|
270
434
|
/** Longest-prefix match over declared routes, or undefined if none match. */
|
|
@@ -304,7 +468,7 @@ async function* iterSseChunks(
|
|
|
304
468
|
for (const line of frame.split('\n')) {
|
|
305
469
|
const t = line.replace(/^/, '').trimStart();
|
|
306
470
|
// SSE comments (":...") are invisible to the payload, but a caller may
|
|
307
|
-
// want them:
|
|
471
|
+
// want them: 0g-harness streams tool-activity progress as
|
|
308
472
|
// ": activity <kind>" comments (keepalives pass through too — the
|
|
309
473
|
// callback filters).
|
|
310
474
|
if (t.startsWith(':') && onComment) onComment(t.slice(1).trim());
|
|
@@ -504,7 +668,7 @@ export function makeAgentClient(params: {
|
|
|
504
668
|
const path = `${chat.prefix}chat/completions`;
|
|
505
669
|
|
|
506
670
|
client.interrupt = async () => {
|
|
507
|
-
//
|
|
671
|
+
// 0g-harness and the prime bridge expose a real endpoint; call it. openclaw/hermes
|
|
508
672
|
// serve /v1 themselves (404 here) and both stop the turn when the
|
|
509
673
|
// client disconnects — LAB- and live-verified for openclaw (the run
|
|
510
674
|
// ends stopReason=aborted the moment the stream drops; no
|
|
@@ -617,11 +781,11 @@ export function makeAgentClient(params: {
|
|
|
617
781
|
|
|
618
782
|
// ── Responses transport (the long-task surface) ──────────────────────────
|
|
619
783
|
//
|
|
620
|
-
// When the agent declares a `kind: "responses"` route (prime
|
|
621
|
-
// natively; openclaw/hermes via the sealed proxy's synthesized
|
|
622
|
-
// turn is owned by a server-side response id, not by the HTTP
|
|
623
|
-
// so it survives network drops and the sandbox preview proxy's
|
|
624
|
-
// duration cap (~300s on mainnet, 0g-sandbox#122). chat/chatStream are
|
|
784
|
+
// When the agent declares a `kind: "responses"` route (the prime bridge and
|
|
785
|
+
// 0g-harness natively; openclaw/hermes via the sealed proxy's synthesized
|
|
786
|
+
// layer), a turn is owned by a server-side response id, not by the HTTP
|
|
787
|
+
// connection — so it survives network drops and the sandbox preview proxy's
|
|
788
|
+
// request-duration cap (~300s on mainnet, 0g-sandbox#122). chat/chatStream are
|
|
625
789
|
// REPLACED to ride it: same signatures, but a dropped connection now means
|
|
626
790
|
// "resume from the last sequence number", not "the task died". task/
|
|
627
791
|
// followTask/cancelTask expose the id-level surface for re-attaching later.
|
|
@@ -873,6 +1037,159 @@ export function makeAgentClient(params: {
|
|
|
873
1037
|
};
|
|
874
1038
|
}
|
|
875
1039
|
|
|
1040
|
+
// ── The agent's own work: inbox, live feed, tasks, reminders ─────────────
|
|
1041
|
+
//
|
|
1042
|
+
// An agent that works in the background (commands, subagents, reminders)
|
|
1043
|
+
// also opens turns by itself, and their words belong to no chat request.
|
|
1044
|
+
// These kinds are where they surface (0g-harness, docs/PROTOCOL.md). Each
|
|
1045
|
+
// method is attached only for a kind the agent declares, like chat; agents
|
|
1046
|
+
// that declare none of them are unaffected.
|
|
1047
|
+
const ownerBase = (kind: string): string | undefined => {
|
|
1048
|
+
const r = routes.find((x) => x.kind === kind);
|
|
1049
|
+
return r && canAuth ? r.prefix.replace(/\/$/, '') : undefined;
|
|
1050
|
+
};
|
|
1051
|
+
const query = (params: Record<string, string | number | undefined>): string => {
|
|
1052
|
+
const q = new URLSearchParams();
|
|
1053
|
+
for (const [k, v] of Object.entries(params)) if (v !== undefined) q.set(k, String(v));
|
|
1054
|
+
const s = q.toString();
|
|
1055
|
+
return s ? `?${s}` : '';
|
|
1056
|
+
};
|
|
1057
|
+
const getJSON = async <T>(what: string, path: string): Promise<T> => {
|
|
1058
|
+
const r = await doFetch(path);
|
|
1059
|
+
if (!r.ok) throw new Error(`${what}: HTTP ${r.status}: ${await r.text()}`);
|
|
1060
|
+
return (await r.json()) as T;
|
|
1061
|
+
};
|
|
1062
|
+
const postJSON = async <T>(what: string, path: string, body?: unknown): Promise<T> => {
|
|
1063
|
+
const r = await doFetch(path, {
|
|
1064
|
+
method: 'POST',
|
|
1065
|
+
...(body === undefined ? {} : { headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }),
|
|
1066
|
+
});
|
|
1067
|
+
if (!r.ok) throw new Error(`${what}: HTTP ${r.status}: ${await r.text()}`);
|
|
1068
|
+
return (await r.json()) as T;
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
const inboxBase = ownerBase('inbox');
|
|
1072
|
+
if (inboxBase) {
|
|
1073
|
+
client.inbox = (opts) => getJSON<AgentInbox>('inbox', `${inboxBase}${query({ after: opts?.after, limit: opts?.limit })}`);
|
|
1074
|
+
client.ackInbox = (through) => postJSON('ackInbox', `${inboxBase}/ack`, { through });
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
const tasksBase = ownerBase('tasks');
|
|
1078
|
+
if (tasksBase) {
|
|
1079
|
+
client.tasks = async (opts) =>
|
|
1080
|
+
(await getJSON<{ data: AgentTaskInfo[] }>('tasks', `${tasksBase}${query({ status: opts?.status, limit: opts?.limit })}`)).data;
|
|
1081
|
+
client.taskInfo = (id) => getJSON<AgentTaskInfo>('taskInfo', `${tasksBase}/${encodeURIComponent(id)}`);
|
|
1082
|
+
client.stopTask = async (id) => {
|
|
1083
|
+
// `all` is a different request with a different answer.
|
|
1084
|
+
if (id === 'all') throw new Error('stopTask: "all" is stopAllTasks()');
|
|
1085
|
+
return postJSON<AgentTaskStop>('stopTask', `${tasksBase}/${encodeURIComponent(id)}/cancel`);
|
|
1086
|
+
};
|
|
1087
|
+
client.stopAllTasks = async () =>
|
|
1088
|
+
(await postJSON<{ data: AgentTaskStop[] }>('stopAllTasks', `${tasksBase}/all/cancel`)).data;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
const schedulesBase = ownerBase('schedules');
|
|
1092
|
+
if (schedulesBase) {
|
|
1093
|
+
client.schedules = async () => {
|
|
1094
|
+
const j = await getJSON<{ enabled?: boolean; data?: AgentSchedule[] }>('schedules', schedulesBase);
|
|
1095
|
+
return { enabled: j.enabled !== false, data: j.data ?? [] };
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
const eventsBase = ownerBase('events');
|
|
1100
|
+
if (eventsBase) {
|
|
1101
|
+
// The agent sends a keepalive every 10s, so this much silence means the
|
|
1102
|
+
// connection is gone — the responses transport's rule, and its knob.
|
|
1103
|
+
const stallMs = params.stallMs ?? 90_000;
|
|
1104
|
+
const pollMs = Math.max(50, Math.floor(stallMs / 6));
|
|
1105
|
+
// A feed has no end to wait for, so a failure never ends it: it backs off
|
|
1106
|
+
// to a ceiling and keeps trying. An agent restarting (a settings push
|
|
1107
|
+
// restarts its process) is a normal reason to be away for a while.
|
|
1108
|
+
const backoff = (n: number): number => Math.min(500 * 2 ** n, 30_000, Math.max(50, stallMs * 4));
|
|
1109
|
+
const sleep = (ms: number, signal?: AbortSignal): Promise<void> =>
|
|
1110
|
+
new Promise((resolve) => {
|
|
1111
|
+
const done = (): void => {
|
|
1112
|
+
clearTimeout(t);
|
|
1113
|
+
signal?.removeEventListener('abort', done);
|
|
1114
|
+
resolve();
|
|
1115
|
+
};
|
|
1116
|
+
const t = setTimeout(done, ms);
|
|
1117
|
+
signal?.addEventListener('abort', done, { once: true });
|
|
1118
|
+
});
|
|
1119
|
+
|
|
1120
|
+
client.events = async function* (opts) {
|
|
1121
|
+
const signal = opts?.signal;
|
|
1122
|
+
let pos = opts?.after;
|
|
1123
|
+
let failures = 0;
|
|
1124
|
+
while (!signal?.aborted) {
|
|
1125
|
+
const attempt = new AbortController();
|
|
1126
|
+
const onAbort = (): void => attempt.abort();
|
|
1127
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
1128
|
+
let lastByteAt = Date.now();
|
|
1129
|
+
let sawBytes = false;
|
|
1130
|
+
const watchdog = setInterval(() => {
|
|
1131
|
+
if (Date.now() - lastByteAt > stallMs) attempt.abort();
|
|
1132
|
+
}, pollMs);
|
|
1133
|
+
try {
|
|
1134
|
+
let res: Response | undefined;
|
|
1135
|
+
try {
|
|
1136
|
+
res = await doFetch(`${eventsBase}${query({ after: pos })}`, { signal: attempt.signal });
|
|
1137
|
+
} catch {
|
|
1138
|
+
// the network, or an agent that is not up: try again below
|
|
1139
|
+
}
|
|
1140
|
+
if (res && !res.ok) {
|
|
1141
|
+
const text = await res.text().catch(() => '');
|
|
1142
|
+
// A 4xx is an answer (the route is gone, the handle is refused),
|
|
1143
|
+
// and asking again gets the same one.
|
|
1144
|
+
if (res.status < 500 && res.status !== 408 && res.status !== 429) {
|
|
1145
|
+
throw new Error(`events: HTTP ${res.status}: ${text}`);
|
|
1146
|
+
}
|
|
1147
|
+
res = undefined;
|
|
1148
|
+
}
|
|
1149
|
+
if (res) {
|
|
1150
|
+
if (!res.body || !(res.headers.get('content-type') ?? '').toLowerCase().includes('text/event-stream')) {
|
|
1151
|
+
throw new Error('events: expected an SSE stream from the events route');
|
|
1152
|
+
}
|
|
1153
|
+
const heard = (): void => {
|
|
1154
|
+
lastByteAt = Date.now();
|
|
1155
|
+
sawBytes = true;
|
|
1156
|
+
};
|
|
1157
|
+
try {
|
|
1158
|
+
for await (const chunk of iterSseChunks(res.body, heard)) {
|
|
1159
|
+
heard();
|
|
1160
|
+
const { __sseEvent, ...data } = chunk as Record<string, unknown> & { __sseEvent?: string };
|
|
1161
|
+
const { seq, time } = data;
|
|
1162
|
+
if (typeof seq !== 'number') continue;
|
|
1163
|
+
const type = __sseEvent ?? '';
|
|
1164
|
+
if (type === 'reset') {
|
|
1165
|
+
// The position moves to the agent's cursor, backwards too
|
|
1166
|
+
// (after a /clear). The backlog the agent sends after a
|
|
1167
|
+
// reset is older than it, and is skipped below.
|
|
1168
|
+
pos = typeof data.cursor === 'number' ? data.cursor : seq;
|
|
1169
|
+
} else {
|
|
1170
|
+
if (pos !== undefined && seq <= pos) continue;
|
|
1171
|
+
pos = seq;
|
|
1172
|
+
}
|
|
1173
|
+
yield { type, seq, time: typeof time === 'number' ? time : Date.now(), data };
|
|
1174
|
+
}
|
|
1175
|
+
} catch {
|
|
1176
|
+
// cut mid-stream, or the stall watchdog: reopen from `pos`
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
} finally {
|
|
1180
|
+
clearInterval(watchdog);
|
|
1181
|
+
signal?.removeEventListener('abort', onAbort);
|
|
1182
|
+
}
|
|
1183
|
+
if (signal?.aborted) return;
|
|
1184
|
+
// A connection that carried anything (keepalives included) was
|
|
1185
|
+
// healthy until it closed (a proxy's request-duration cap, an agent
|
|
1186
|
+
// restart): reopen at once. One that carried nothing backs off.
|
|
1187
|
+
if (sawBytes) failures = 0;
|
|
1188
|
+
else await sleep(backoff(++failures), signal);
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
|
|
876
1193
|
// Owner-only: read the agent's own process log. Gated on the wallet-backed
|
|
877
1194
|
// signer (not `canAuth`) — /log/agent verifies a per-request owner signature,
|
|
878
1195
|
// so a client holding only a shared bearer token can't read logs.
|