@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
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* reachable with only an attestor URL; `link`/`deploy` (signing operations)
|
|
13
13
|
* check for a key and point you at `login` if it's missing.
|
|
14
14
|
*/
|
|
15
|
+
import * as readline from 'node:readline';
|
|
16
|
+
import type { AgentClient, AgentInboxMessage, AgentSchedule, AgentTaskInfo } from '../../AgentClient';
|
|
15
17
|
/** -1/0/1 numeric dot-compare ("0.1.9" < "0.1.10"). Exported for tests —
|
|
16
18
|
* a wrong compare either nags forever or never hints. */
|
|
17
19
|
export declare function compareVersions(a: string, b: string): number;
|
|
@@ -69,8 +71,9 @@ export declare function brakeInterruptLine(e: unknown): string;
|
|
|
69
71
|
export declare function routeTaskFailure(print: (line: string) => void, seat: (failure: string, reclaimedHint: string, leavesWhat?: string) => Promise<'reclaimed' | 'left' | null>, e: unknown, rawLine: string, seatHint: string): Promise<'reclaimed' | 'left' | 'raw'>;
|
|
70
72
|
/**
|
|
71
73
|
* The tasks bare `/cancel` stops: everything still in flight, NEWEST FIRST
|
|
72
|
-
* (stopping only the newest would leave an older running turn alive;
|
|
73
|
-
* prime serialize turns, so a queued one is waiting on the
|
|
74
|
+
* (stopping only the newest would leave an older running turn alive;
|
|
75
|
+
* 0g-harness and prime serialize turns, so a queued one is waiting on the
|
|
76
|
+
* running one).
|
|
74
77
|
* Statuses arrive live from the agent; "unknown" (evicted or agent
|
|
75
78
|
* restarted, 404) counts as not in flight — cancelling an unknown record
|
|
76
79
|
* would claim to stop something nobody can see. Exported for the tests:
|
|
@@ -80,6 +83,35 @@ export declare function inFlightIds(rows: Array<{
|
|
|
80
83
|
id: string;
|
|
81
84
|
status: string;
|
|
82
85
|
}>): string[];
|
|
86
|
+
/**
|
|
87
|
+
* The /tasks table over the agent's own task list: BY is who does the work
|
|
88
|
+
* (the main agent or a subagent), FOR is who asked (you, a finished job, a
|
|
89
|
+
* reminder, the agent itself). Ids print whole: they are what /result and
|
|
90
|
+
* /cancel take. Exported for the tests.
|
|
91
|
+
*/
|
|
92
|
+
export declare function renderTaskTable(tasks: AgentTaskInfo[], nowMs: number): string[];
|
|
93
|
+
/**
|
|
94
|
+
* One inbox message as the session prints it: why the agent spoke up, then
|
|
95
|
+
* what it said. Exported for the tests.
|
|
96
|
+
*/
|
|
97
|
+
export declare function renderInboxMessage(m: AgentInboxMessage): string;
|
|
98
|
+
/** The /schedules lines: id, how often, when next, the reminder's text.
|
|
99
|
+
* Exported for the tests. */
|
|
100
|
+
export declare function renderSchedules(list: AgentSchedule[], nowMs: number): string[];
|
|
101
|
+
/**
|
|
102
|
+
* Follows one agent's inbox for a session: first the messages that came in
|
|
103
|
+
* while nobody was looking, then each new one as the agent's live feed
|
|
104
|
+
* announces it. `show` prints a rendered message, now or at the next prompt,
|
|
105
|
+
* and calls `shown` once it is on screen; the message is acked then, so
|
|
106
|
+
* another window does not show it again. A message is shown once per feed.
|
|
107
|
+
* `follow` is called with the session's current client before every prompt
|
|
108
|
+
* and restarts the feed when the client changed (/start, /reset); an agent
|
|
109
|
+
* without an inbox gets no feed. Exported for the tests.
|
|
110
|
+
*/
|
|
111
|
+
export declare function makeInboxFeed(show: (text: string, shown: () => void) => void): {
|
|
112
|
+
follow(client: AgentClient | undefined): void;
|
|
113
|
+
stop(): void;
|
|
114
|
+
};
|
|
83
115
|
export declare function completeTail(cmd: string, word: string, models: string[], providers?: string[]): string[];
|
|
84
116
|
export declare function completeLine(line: string, state: {
|
|
85
117
|
completions: string[];
|
|
@@ -89,6 +121,17 @@ export declare function completeLine(line: string, state: {
|
|
|
89
121
|
providerModels?: Record<string, string[]>;
|
|
90
122
|
providers?: string[];
|
|
91
123
|
}): [string[], string];
|
|
124
|
+
/**
|
|
125
|
+
* Print a block above the live prompt, keeping what the user has typed. The
|
|
126
|
+
* prompt and its input are erased from their first row down, the block is
|
|
127
|
+
* written, and readline redraws the prompt below it. Its redraw first moves
|
|
128
|
+
* up as many rows as the cursor sat below the prompt's first row (the
|
|
129
|
+
* prompt's own leading newline counts), so that many blank rows are left for
|
|
130
|
+
* it to land on. Without a terminal there is no prompt to keep: the block is
|
|
131
|
+
* just written. `rl`/`output` are the session's; exported for the tests,
|
|
132
|
+
* which pass a readline over a captured stream.
|
|
133
|
+
*/
|
|
134
|
+
export declare function printAbovePrompt(text: string, rl?: readline.Interface | null, output?: NodeJS.WritableStream): void;
|
|
92
135
|
import type { CommandContext } from '../types';
|
|
93
136
|
/** The REPL listing's header line, aligned with {@link renderListRow}. */
|
|
94
137
|
export declare function renderListHeader(): string;
|
|
@@ -111,5 +154,31 @@ export declare function renderListRow(r: {
|
|
|
111
154
|
framework?: string | null;
|
|
112
155
|
agentSeal?: string | null;
|
|
113
156
|
}, owner: string | null | undefined, owned?: string, sealToAgent?: ReadonlyMap<string, string>): string;
|
|
157
|
+
/** An agent's container state just before a lifecycle request was sent. */
|
|
158
|
+
export interface LifecycleBaseline {
|
|
159
|
+
/** The container stage's `at`, in ms (server clock); undefined when it has none. */
|
|
160
|
+
at?: number;
|
|
161
|
+
state?: string;
|
|
162
|
+
sandboxId?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Read the row a lifecycle request is about to change. The attestor answers
|
|
166
|
+
* `/reset` and `/start` with 202 before its worker touches the row, so the
|
|
167
|
+
* wait compares against this. undefined when the row cannot be read; the wait
|
|
168
|
+
* then takes the row as it finds it.
|
|
169
|
+
*/
|
|
170
|
+
export declare function lifecycleBaseline(attestorUrl: string, sealId: `0x${string}`): Promise<LifecycleBaseline | undefined>;
|
|
171
|
+
export declare function pollRunning(attestorUrl: string, sealId: `0x${string}`, agentId: string, timeoutMs?: number, signal?: AbortSignal, opts?: {
|
|
172
|
+
baseline?: LifecycleBaseline;
|
|
173
|
+
intervalMs?: number;
|
|
174
|
+
}): Promise<{
|
|
175
|
+
url: string;
|
|
176
|
+
}>;
|
|
114
177
|
export declare function run(ctx: CommandContext): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Whether the deploy wizard offers `framework` only models with tool use: the
|
|
180
|
+
* tool-driven frameworks, the harness under either of its names (`dsh` on a
|
|
181
|
+
* network still on AgentDNA 1.3, see `isHarnessFramework`).
|
|
182
|
+
*/
|
|
183
|
+
export declare function frameworkNeedsToolModels(framework: string): boolean;
|
|
115
184
|
//# sourceMappingURL=interactive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/interactive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/interactive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAM1C,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAA8B,MAAM,mBAAmB,CAAC;AA2FlI;0DAC0D;AAC1D,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAU5D;AAGD;0BAC0B;AAC1B,wBAAgB,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;;;;;;GAWG;AACH;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAKvB,SAAS,EAAE,MAAM;IAAE,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,EACtG,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAE7B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC,EAC3G,iBAAiB,EAAE,MAAM,OAAO,GAC/B,MAAM,IAAI,CAgBZ;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAWrD;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,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