@tonbo/cli 0.0.5 → 0.0.7
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/README.md +75 -9
- package/dist/bin/tonbo.js +1981 -0
- package/package.json +8 -5
- package/dist/src/api.d.ts +0 -70
- package/dist/src/api.js +0 -179
- package/dist/src/app.d.ts +0 -4
- package/dist/src/app.js +0 -113
- package/dist/src/auth.d.ts +0 -20
- package/dist/src/auth.js +0 -196
- package/dist/src/callback-page.d.ts +0 -23
- package/dist/src/callback-page.js +0 -145
- package/dist/src/commands.d.ts +0 -45
- package/dist/src/commands.js +0 -237
- package/dist/src/config.d.ts +0 -13
- package/dist/src/config.js +0 -46
- package/dist/src/contracts.d.ts +0 -3
- package/dist/src/contracts.js +0 -24
- package/dist/src/credentials.d.ts +0 -17
- package/dist/src/credentials.js +0 -90
- package/dist/src/declaration.d.ts +0 -10
- package/dist/src/declaration.js +0 -98
- package/dist/src/generated/contracts.d.ts +0 -188
- package/dist/src/generated/contracts.js +0 -226
- package/dist/src/http.d.ts +0 -6
- package/dist/src/http.js +0 -19
- package/dist/src/main.d.ts +0 -2
- package/dist/src/main.js +0 -9
- package/dist/src/progress.d.ts +0 -25
- package/dist/src/progress.js +0 -60
- package/dist/src/prompt.d.ts +0 -1
- package/dist/src/prompt.js +0 -10
- package/dist/src/source.d.ts +0 -8
- package/dist/src/source.js +0 -139
- package/dist/src/ssh-key.d.ts +0 -9
- package/dist/src/ssh-key.js +0 -36
- package/dist/src/ssh.d.ts +0 -3
- package/dist/src/ssh.js +0 -22
- package/dist/src/types.d.ts +0 -85
- package/dist/src/types.js +0 -1
package/dist/src/declaration.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { lstat, open, readFile, rename, rm } from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { parse, stringify } from "smol-toml";
|
|
5
|
-
import { assertManagedRevision, parseDeclaration } from "./contracts.js";
|
|
6
|
-
export const DECLARATION_FILENAME = ".tonbo";
|
|
7
|
-
export const DEFAULT_INFERENCE_MODEL = "claude-sonnet-4-5";
|
|
8
|
-
export function createDeclaration(model = DEFAULT_INFERENCE_MODEL) {
|
|
9
|
-
return parseDeclaration({
|
|
10
|
-
version: 1,
|
|
11
|
-
execution: { mode: "managed", runtime: "pi" },
|
|
12
|
-
inference: { model: model.trim() },
|
|
13
|
-
session_capture: { adapter: "pi-jsonl-v3" },
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
export function renderDeclaration(declaration) {
|
|
17
|
-
return `# Tonbo Project Agent configuration.\n${stringify(declaration)}`;
|
|
18
|
-
}
|
|
19
|
-
export async function declarationExists(root) {
|
|
20
|
-
const filename = path.join(root, DECLARATION_FILENAME);
|
|
21
|
-
try {
|
|
22
|
-
const metadata = await lstat(filename);
|
|
23
|
-
if (metadata.isSymbolicLink() || !metadata.isFile())
|
|
24
|
-
throw new Error(`${filename} must be a regular file.`);
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
if (error.code === "ENOENT")
|
|
29
|
-
return false;
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export async function saveDeclaration(root, declaration, overwrite) {
|
|
34
|
-
const filename = path.join(root, DECLARATION_FILENAME);
|
|
35
|
-
const exists = await declarationExists(root);
|
|
36
|
-
if (exists && !overwrite)
|
|
37
|
-
throw new Error(`${DECLARATION_FILENAME} already exists. Pass --force to replace it.`);
|
|
38
|
-
const contents = renderDeclaration(declaration);
|
|
39
|
-
if (!overwrite) {
|
|
40
|
-
const handle = await open(filename, "wx", 0o644).catch((error) => {
|
|
41
|
-
if (error.code === "EEXIST")
|
|
42
|
-
throw new Error(`${DECLARATION_FILENAME} already exists. Pass --force to replace it.`);
|
|
43
|
-
throw error;
|
|
44
|
-
});
|
|
45
|
-
try {
|
|
46
|
-
await handle.writeFile(contents, "utf8");
|
|
47
|
-
await handle.sync();
|
|
48
|
-
}
|
|
49
|
-
finally {
|
|
50
|
-
await handle.close();
|
|
51
|
-
}
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const temporary = path.join(root, `.${DECLARATION_FILENAME}.${process.pid}.${randomUUID()}.tmp`);
|
|
55
|
-
let handle;
|
|
56
|
-
try {
|
|
57
|
-
handle = await open(temporary, "wx", 0o644);
|
|
58
|
-
await handle.writeFile(contents, "utf8");
|
|
59
|
-
await handle.sync();
|
|
60
|
-
await handle.close();
|
|
61
|
-
handle = undefined;
|
|
62
|
-
await rename(temporary, filename);
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
await handle?.close().catch(() => undefined);
|
|
66
|
-
await rm(temporary, { force: true }).catch(() => undefined);
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
export async function loadDeclaration(declarationRoot) {
|
|
71
|
-
const filename = path.join(declarationRoot, DECLARATION_FILENAME);
|
|
72
|
-
let parsed;
|
|
73
|
-
try {
|
|
74
|
-
parsed = parse(await readFile(filename, "utf8"));
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
if (error.code === "ENOENT")
|
|
78
|
-
throw new Error(`No ${DECLARATION_FILENAME} declaration found at ${filename}.`);
|
|
79
|
-
throw new Error(`Could not read ${filename} as TOML.`, { cause: error });
|
|
80
|
-
}
|
|
81
|
-
return parseDeclaration(parsed);
|
|
82
|
-
}
|
|
83
|
-
export function buildRevision(declaration, source) {
|
|
84
|
-
const spec = {
|
|
85
|
-
version: 1,
|
|
86
|
-
execution: declaration.execution,
|
|
87
|
-
source: {
|
|
88
|
-
format: source.format,
|
|
89
|
-
sha256: source.sha256,
|
|
90
|
-
size_bytes: source.size_bytes,
|
|
91
|
-
},
|
|
92
|
-
inference: declaration.inference,
|
|
93
|
-
session_capture: { adapter: declaration.session_capture.adapter },
|
|
94
|
-
...(declaration.service ? { service: declaration.service } : {}),
|
|
95
|
-
};
|
|
96
|
-
assertManagedRevision(spec);
|
|
97
|
-
return spec;
|
|
98
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
export declare const projectServiceSchema: {
|
|
2
|
-
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
3
|
-
readonly $id: "https://contracts.tonbo.dev/agents/project-service-v1.schema.json";
|
|
4
|
-
readonly title: "Tonbo Project application service v1";
|
|
5
|
-
readonly type: "object";
|
|
6
|
-
readonly additionalProperties: false;
|
|
7
|
-
readonly required: readonly ["command"];
|
|
8
|
-
readonly properties: {
|
|
9
|
-
readonly command: {
|
|
10
|
-
readonly type: "array";
|
|
11
|
-
readonly minItems: 1;
|
|
12
|
-
readonly maxItems: 64;
|
|
13
|
-
readonly items: {
|
|
14
|
-
readonly type: "string";
|
|
15
|
-
readonly minLength: 1;
|
|
16
|
-
readonly maxLength: 4096;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
readonly secrets: {
|
|
20
|
-
readonly type: "array";
|
|
21
|
-
readonly maxItems: 32;
|
|
22
|
-
readonly uniqueItems: true;
|
|
23
|
-
readonly items: {
|
|
24
|
-
readonly type: "string";
|
|
25
|
-
readonly pattern: "^[A-Z_][A-Z0-9_]{0,127}$";
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
readonly kubernetes: {
|
|
29
|
-
readonly $ref: "https://contracts.tonbo.dev/agents/kubernetes-profiles-v1.schema.json#/$defs/request";
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export declare const kubernetesProfilesSchema: {
|
|
34
|
-
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
35
|
-
readonly $id: "https://contracts.tonbo.dev/agents/kubernetes-profiles-v1.schema.json";
|
|
36
|
-
readonly title: "Tonbo managed Kubernetes profiles v1";
|
|
37
|
-
readonly $defs: {
|
|
38
|
-
readonly request: {
|
|
39
|
-
readonly type: "object";
|
|
40
|
-
readonly additionalProperties: false;
|
|
41
|
-
readonly required: readonly ["profile"];
|
|
42
|
-
readonly properties: {
|
|
43
|
-
readonly profile: false;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
readonly "x-tonbo-profiles": {};
|
|
48
|
-
};
|
|
49
|
-
export declare const declarationSchema: {
|
|
50
|
-
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
51
|
-
readonly $id: "https://contracts.tonbo.dev/agents/tonbo-declaration-v1.schema.json";
|
|
52
|
-
readonly title: "Tonbo Project Agent declaration v1";
|
|
53
|
-
readonly type: "object";
|
|
54
|
-
readonly additionalProperties: false;
|
|
55
|
-
readonly required: readonly ["version", "execution", "session_capture"];
|
|
56
|
-
readonly properties: {
|
|
57
|
-
readonly version: {
|
|
58
|
-
readonly const: 1;
|
|
59
|
-
};
|
|
60
|
-
readonly execution: {
|
|
61
|
-
readonly type: "object";
|
|
62
|
-
readonly additionalProperties: false;
|
|
63
|
-
readonly required: readonly ["mode", "runtime"];
|
|
64
|
-
readonly properties: {
|
|
65
|
-
readonly mode: {
|
|
66
|
-
readonly const: "managed";
|
|
67
|
-
};
|
|
68
|
-
readonly runtime: {
|
|
69
|
-
readonly const: "pi";
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
readonly inference: {
|
|
74
|
-
readonly type: "object";
|
|
75
|
-
readonly additionalProperties: false;
|
|
76
|
-
readonly default: {
|
|
77
|
-
readonly model: "claude-sonnet-4-5";
|
|
78
|
-
};
|
|
79
|
-
readonly required: readonly ["model"];
|
|
80
|
-
readonly properties: {
|
|
81
|
-
readonly model: {
|
|
82
|
-
readonly type: "string";
|
|
83
|
-
readonly minLength: 1;
|
|
84
|
-
readonly maxLength: 160;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
readonly session_capture: {
|
|
89
|
-
readonly type: "object";
|
|
90
|
-
readonly additionalProperties: false;
|
|
91
|
-
readonly required: readonly ["adapter"];
|
|
92
|
-
readonly properties: {
|
|
93
|
-
readonly adapter: {
|
|
94
|
-
readonly const: "pi-jsonl-v3";
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
readonly service: {
|
|
99
|
-
readonly $ref: "https://contracts.tonbo.dev/agents/project-service-v1.schema.json";
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
export declare const revisionSchema: {
|
|
104
|
-
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
105
|
-
readonly $id: "https://contracts.tonbo.dev/agents/managed-revision-v1.schema.json";
|
|
106
|
-
readonly title: "Managed Project revision v1";
|
|
107
|
-
readonly type: "object";
|
|
108
|
-
readonly additionalProperties: false;
|
|
109
|
-
readonly required: readonly ["version", "execution", "source", "inference", "session_capture"];
|
|
110
|
-
readonly properties: {
|
|
111
|
-
readonly version: {
|
|
112
|
-
readonly const: 1;
|
|
113
|
-
};
|
|
114
|
-
readonly execution: {
|
|
115
|
-
readonly type: "object";
|
|
116
|
-
readonly additionalProperties: false;
|
|
117
|
-
readonly required: readonly ["mode", "runtime"];
|
|
118
|
-
readonly properties: {
|
|
119
|
-
readonly mode: {
|
|
120
|
-
readonly const: "managed";
|
|
121
|
-
};
|
|
122
|
-
readonly runtime: {
|
|
123
|
-
readonly const: "pi";
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
readonly source: {
|
|
128
|
-
readonly type: "object";
|
|
129
|
-
readonly additionalProperties: false;
|
|
130
|
-
readonly required: readonly ["format", "sha256", "size_bytes"];
|
|
131
|
-
readonly properties: {
|
|
132
|
-
readonly format: {
|
|
133
|
-
readonly const: "tar-v1";
|
|
134
|
-
};
|
|
135
|
-
readonly sha256: {
|
|
136
|
-
readonly type: "string";
|
|
137
|
-
readonly pattern: "^[0-9a-f]{64}$";
|
|
138
|
-
};
|
|
139
|
-
readonly size_bytes: {
|
|
140
|
-
readonly type: "integer";
|
|
141
|
-
readonly minimum: 1;
|
|
142
|
-
readonly maximum: 67108864;
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
readonly inference: {
|
|
147
|
-
readonly type: "object";
|
|
148
|
-
readonly additionalProperties: false;
|
|
149
|
-
readonly required: readonly ["model"];
|
|
150
|
-
readonly properties: {
|
|
151
|
-
readonly model: {
|
|
152
|
-
readonly type: "string";
|
|
153
|
-
readonly minLength: 1;
|
|
154
|
-
readonly maxLength: 160;
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
readonly session_capture: {
|
|
159
|
-
readonly type: "object";
|
|
160
|
-
readonly additionalProperties: false;
|
|
161
|
-
readonly required: readonly ["adapter"];
|
|
162
|
-
readonly properties: {
|
|
163
|
-
readonly adapter: {
|
|
164
|
-
readonly const: "pi-jsonl-v3";
|
|
165
|
-
};
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
readonly service: {
|
|
169
|
-
readonly $ref: "https://contracts.tonbo.dev/agents/project-service-v1.schema.json";
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
export declare const sourceBundleContract: {
|
|
174
|
-
readonly version: 1;
|
|
175
|
-
readonly format: "tar-v1";
|
|
176
|
-
readonly bucket: "agent-source-bundles";
|
|
177
|
-
readonly content_type: "application/vnd.tonbo.source+tar";
|
|
178
|
-
readonly max_bytes: 67108864;
|
|
179
|
-
};
|
|
180
|
-
export declare const piSessionContract: {
|
|
181
|
-
readonly version: 1;
|
|
182
|
-
readonly adapter: "pi-jsonl-v3";
|
|
183
|
-
readonly format_version: 3;
|
|
184
|
-
readonly durable_completion_timeout_seconds: 30;
|
|
185
|
-
readonly session_directory: "/sessions";
|
|
186
|
-
readonly path_template: "/sessions/{session_id}.jsonl";
|
|
187
|
-
readonly preflight_command: readonly ["/usr/local/bin/artifacts", "runtime", "session-preflight"];
|
|
188
|
-
};
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
// Generated from contracts/agents/project-service-v1.schema.json and contracts/agents/kubernetes-profiles-v1.schema.json and contracts/agents/tonbo-declaration-v1.schema.json and contracts/agents/managed-revision-v1.schema.json and contracts/agents/source-bundle-v1.json and contracts/agents/pi-session-v1.json.
|
|
2
|
-
// Run pnpm generate:contracts after changing a canonical Agent contract.
|
|
3
|
-
export const projectServiceSchema = {
|
|
4
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
5
|
-
"$id": "https://contracts.tonbo.dev/agents/project-service-v1.schema.json",
|
|
6
|
-
"title": "Tonbo Project application service v1",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"additionalProperties": false,
|
|
9
|
-
"required": [
|
|
10
|
-
"command"
|
|
11
|
-
],
|
|
12
|
-
"properties": {
|
|
13
|
-
"command": {
|
|
14
|
-
"type": "array",
|
|
15
|
-
"minItems": 1,
|
|
16
|
-
"maxItems": 64,
|
|
17
|
-
"items": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"minLength": 1,
|
|
20
|
-
"maxLength": 4096
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"secrets": {
|
|
24
|
-
"type": "array",
|
|
25
|
-
"maxItems": 32,
|
|
26
|
-
"uniqueItems": true,
|
|
27
|
-
"items": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"pattern": "^[A-Z_][A-Z0-9_]{0,127}$"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"kubernetes": {
|
|
33
|
-
"$ref": "https://contracts.tonbo.dev/agents/kubernetes-profiles-v1.schema.json#/$defs/request"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
export const kubernetesProfilesSchema = {
|
|
38
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
39
|
-
"$id": "https://contracts.tonbo.dev/agents/kubernetes-profiles-v1.schema.json",
|
|
40
|
-
"title": "Tonbo managed Kubernetes profiles v1",
|
|
41
|
-
"$defs": {
|
|
42
|
-
"request": {
|
|
43
|
-
"type": "object",
|
|
44
|
-
"additionalProperties": false,
|
|
45
|
-
"required": [
|
|
46
|
-
"profile"
|
|
47
|
-
],
|
|
48
|
-
"properties": {
|
|
49
|
-
"profile": false
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"x-tonbo-profiles": {}
|
|
54
|
-
};
|
|
55
|
-
export const declarationSchema = {
|
|
56
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
57
|
-
"$id": "https://contracts.tonbo.dev/agents/tonbo-declaration-v1.schema.json",
|
|
58
|
-
"title": "Tonbo Project Agent declaration v1",
|
|
59
|
-
"type": "object",
|
|
60
|
-
"additionalProperties": false,
|
|
61
|
-
"required": [
|
|
62
|
-
"version",
|
|
63
|
-
"execution",
|
|
64
|
-
"session_capture"
|
|
65
|
-
],
|
|
66
|
-
"properties": {
|
|
67
|
-
"version": {
|
|
68
|
-
"const": 1
|
|
69
|
-
},
|
|
70
|
-
"execution": {
|
|
71
|
-
"type": "object",
|
|
72
|
-
"additionalProperties": false,
|
|
73
|
-
"required": [
|
|
74
|
-
"mode",
|
|
75
|
-
"runtime"
|
|
76
|
-
],
|
|
77
|
-
"properties": {
|
|
78
|
-
"mode": {
|
|
79
|
-
"const": "managed"
|
|
80
|
-
},
|
|
81
|
-
"runtime": {
|
|
82
|
-
"const": "pi"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"inference": {
|
|
87
|
-
"type": "object",
|
|
88
|
-
"additionalProperties": false,
|
|
89
|
-
"default": {
|
|
90
|
-
"model": "claude-sonnet-4-5"
|
|
91
|
-
},
|
|
92
|
-
"required": [
|
|
93
|
-
"model"
|
|
94
|
-
],
|
|
95
|
-
"properties": {
|
|
96
|
-
"model": {
|
|
97
|
-
"type": "string",
|
|
98
|
-
"minLength": 1,
|
|
99
|
-
"maxLength": 160
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
"session_capture": {
|
|
104
|
-
"type": "object",
|
|
105
|
-
"additionalProperties": false,
|
|
106
|
-
"required": [
|
|
107
|
-
"adapter"
|
|
108
|
-
],
|
|
109
|
-
"properties": {
|
|
110
|
-
"adapter": {
|
|
111
|
-
"const": "pi-jsonl-v3"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
"service": {
|
|
116
|
-
"$ref": "https://contracts.tonbo.dev/agents/project-service-v1.schema.json"
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
export const revisionSchema = {
|
|
121
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
122
|
-
"$id": "https://contracts.tonbo.dev/agents/managed-revision-v1.schema.json",
|
|
123
|
-
"title": "Managed Project revision v1",
|
|
124
|
-
"type": "object",
|
|
125
|
-
"additionalProperties": false,
|
|
126
|
-
"required": [
|
|
127
|
-
"version",
|
|
128
|
-
"execution",
|
|
129
|
-
"source",
|
|
130
|
-
"inference",
|
|
131
|
-
"session_capture"
|
|
132
|
-
],
|
|
133
|
-
"properties": {
|
|
134
|
-
"version": {
|
|
135
|
-
"const": 1
|
|
136
|
-
},
|
|
137
|
-
"execution": {
|
|
138
|
-
"type": "object",
|
|
139
|
-
"additionalProperties": false,
|
|
140
|
-
"required": [
|
|
141
|
-
"mode",
|
|
142
|
-
"runtime"
|
|
143
|
-
],
|
|
144
|
-
"properties": {
|
|
145
|
-
"mode": {
|
|
146
|
-
"const": "managed"
|
|
147
|
-
},
|
|
148
|
-
"runtime": {
|
|
149
|
-
"const": "pi"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
"source": {
|
|
154
|
-
"type": "object",
|
|
155
|
-
"additionalProperties": false,
|
|
156
|
-
"required": [
|
|
157
|
-
"format",
|
|
158
|
-
"sha256",
|
|
159
|
-
"size_bytes"
|
|
160
|
-
],
|
|
161
|
-
"properties": {
|
|
162
|
-
"format": {
|
|
163
|
-
"const": "tar-v1"
|
|
164
|
-
},
|
|
165
|
-
"sha256": {
|
|
166
|
-
"type": "string",
|
|
167
|
-
"pattern": "^[0-9a-f]{64}$"
|
|
168
|
-
},
|
|
169
|
-
"size_bytes": {
|
|
170
|
-
"type": "integer",
|
|
171
|
-
"minimum": 1,
|
|
172
|
-
"maximum": 67108864
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
"inference": {
|
|
177
|
-
"type": "object",
|
|
178
|
-
"additionalProperties": false,
|
|
179
|
-
"required": [
|
|
180
|
-
"model"
|
|
181
|
-
],
|
|
182
|
-
"properties": {
|
|
183
|
-
"model": {
|
|
184
|
-
"type": "string",
|
|
185
|
-
"minLength": 1,
|
|
186
|
-
"maxLength": 160
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
"session_capture": {
|
|
191
|
-
"type": "object",
|
|
192
|
-
"additionalProperties": false,
|
|
193
|
-
"required": [
|
|
194
|
-
"adapter"
|
|
195
|
-
],
|
|
196
|
-
"properties": {
|
|
197
|
-
"adapter": {
|
|
198
|
-
"const": "pi-jsonl-v3"
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
"service": {
|
|
203
|
-
"$ref": "https://contracts.tonbo.dev/agents/project-service-v1.schema.json"
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
export const sourceBundleContract = {
|
|
208
|
-
"version": 1,
|
|
209
|
-
"format": "tar-v1",
|
|
210
|
-
"bucket": "agent-source-bundles",
|
|
211
|
-
"content_type": "application/vnd.tonbo.source+tar",
|
|
212
|
-
"max_bytes": 67108864
|
|
213
|
-
};
|
|
214
|
-
export const piSessionContract = {
|
|
215
|
-
"version": 1,
|
|
216
|
-
"adapter": "pi-jsonl-v3",
|
|
217
|
-
"format_version": 3,
|
|
218
|
-
"durable_completion_timeout_seconds": 30,
|
|
219
|
-
"session_directory": "/sessions",
|
|
220
|
-
"path_template": "/sessions/{session_id}.jsonl",
|
|
221
|
-
"preflight_command": [
|
|
222
|
-
"/usr/local/bin/artifacts",
|
|
223
|
-
"runtime",
|
|
224
|
-
"session-preflight"
|
|
225
|
-
]
|
|
226
|
-
};
|
package/dist/src/http.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare class HttpError extends Error {
|
|
2
|
-
readonly status: number;
|
|
3
|
-
readonly body: unknown;
|
|
4
|
-
constructor(message: string, status: number, body: unknown);
|
|
5
|
-
}
|
|
6
|
-
export declare function requestJson<T>(fetcher: typeof fetch, url: string, init?: RequestInit): Promise<T>;
|
package/dist/src/http.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export class HttpError extends Error {
|
|
2
|
-
status;
|
|
3
|
-
body;
|
|
4
|
-
constructor(message, status, body) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.status = status;
|
|
7
|
-
this.body = body;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export async function requestJson(fetcher, url, init = {}) {
|
|
11
|
-
const response = await fetcher(url, init);
|
|
12
|
-
const body = (await response.json().catch(() => null));
|
|
13
|
-
if (!response.ok) {
|
|
14
|
-
const record = body && typeof body === "object" ? body : {};
|
|
15
|
-
const message = [record.detail, record.message, record.error, record.title].find((value) => typeof value === "string");
|
|
16
|
-
throw new HttpError(typeof message === "string" ? message : `Request failed with HTTP ${response.status}.`, response.status, body);
|
|
17
|
-
}
|
|
18
|
-
return body;
|
|
19
|
-
}
|
package/dist/src/main.d.ts
DELETED
package/dist/src/main.js
DELETED
package/dist/src/progress.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface ProgressReporter {
|
|
2
|
-
start(message: string): void;
|
|
3
|
-
succeed(message?: string): void;
|
|
4
|
-
fail(message?: string): void;
|
|
5
|
-
}
|
|
6
|
-
interface ProgressStream {
|
|
7
|
-
isTTY?: boolean;
|
|
8
|
-
write(value: string): unknown;
|
|
9
|
-
}
|
|
10
|
-
export declare class TerminalProgress implements ProgressReporter {
|
|
11
|
-
private readonly stream;
|
|
12
|
-
private readonly intervalMs;
|
|
13
|
-
private activeMessage;
|
|
14
|
-
private frame;
|
|
15
|
-
private lastWidth;
|
|
16
|
-
private timer;
|
|
17
|
-
constructor(stream: ProgressStream, intervalMs?: number);
|
|
18
|
-
start(message: string): void;
|
|
19
|
-
succeed(message?: string | undefined): void;
|
|
20
|
-
fail(message?: string | undefined): void;
|
|
21
|
-
private finish;
|
|
22
|
-
private render;
|
|
23
|
-
}
|
|
24
|
-
export declare const silentProgress: ProgressReporter;
|
|
25
|
-
export {};
|
package/dist/src/progress.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
const FRAMES = ["|", "/", "-", "\\"];
|
|
2
|
-
export class TerminalProgress {
|
|
3
|
-
stream;
|
|
4
|
-
intervalMs;
|
|
5
|
-
activeMessage;
|
|
6
|
-
frame = 0;
|
|
7
|
-
lastWidth = 0;
|
|
8
|
-
timer;
|
|
9
|
-
constructor(stream, intervalMs = 80) {
|
|
10
|
-
this.stream = stream;
|
|
11
|
-
this.intervalMs = intervalMs;
|
|
12
|
-
}
|
|
13
|
-
start(message) {
|
|
14
|
-
if (this.activeMessage)
|
|
15
|
-
this.succeed();
|
|
16
|
-
this.activeMessage = message;
|
|
17
|
-
this.frame = 0;
|
|
18
|
-
if (!this.stream.isTTY) {
|
|
19
|
-
this.stream.write(`[..] ${message}\n`);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
this.render(`[${FRAMES[this.frame]}] ${message}`);
|
|
23
|
-
this.timer = setInterval(() => {
|
|
24
|
-
this.frame = (this.frame + 1) % FRAMES.length;
|
|
25
|
-
this.render(`[${FRAMES[this.frame]}] ${this.activeMessage}`);
|
|
26
|
-
}, this.intervalMs);
|
|
27
|
-
this.timer.unref();
|
|
28
|
-
}
|
|
29
|
-
succeed(message = this.activeMessage) {
|
|
30
|
-
this.finish("ok", message);
|
|
31
|
-
}
|
|
32
|
-
fail(message = this.activeMessage) {
|
|
33
|
-
this.finish("!!", message);
|
|
34
|
-
}
|
|
35
|
-
finish(marker, message) {
|
|
36
|
-
if (this.timer)
|
|
37
|
-
clearInterval(this.timer);
|
|
38
|
-
this.timer = undefined;
|
|
39
|
-
this.activeMessage = undefined;
|
|
40
|
-
if (!message)
|
|
41
|
-
return;
|
|
42
|
-
const line = `[${marker}] ${message}`;
|
|
43
|
-
if (this.stream.isTTY) {
|
|
44
|
-
this.render(line);
|
|
45
|
-
this.stream.write("\n");
|
|
46
|
-
this.lastWidth = 0;
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this.stream.write(`${line}\n`);
|
|
50
|
-
}
|
|
51
|
-
render(value) {
|
|
52
|
-
this.stream.write(`\r${value.padEnd(this.lastWidth)}`);
|
|
53
|
-
this.lastWidth = value.length;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export const silentProgress = {
|
|
57
|
-
start: () => { },
|
|
58
|
-
succeed: () => { },
|
|
59
|
-
fail: () => { },
|
|
60
|
-
};
|
package/dist/src/prompt.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function terminalPrompt(question: string): Promise<string>;
|
package/dist/src/prompt.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createInterface } from "node:readline/promises";
|
|
2
|
-
export async function terminalPrompt(question) {
|
|
3
|
-
const prompt = createInterface({ input: process.stdin, output: process.stderr });
|
|
4
|
-
try {
|
|
5
|
-
return await prompt.question(`? ${question}`);
|
|
6
|
-
}
|
|
7
|
-
finally {
|
|
8
|
-
prompt.close();
|
|
9
|
-
}
|
|
10
|
-
}
|
package/dist/src/source.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SourceBundle } from "./types.js";
|
|
2
|
-
export declare function findDeclarationRoot(start: string): Promise<string>;
|
|
3
|
-
/**
|
|
4
|
-
* Build one deterministic local-source snapshot. Git metadata and timestamps
|
|
5
|
-
* are deliberately absent: the bytes the user deploys are the revision input,
|
|
6
|
-
* and equal directory contents must produce the same identity on every machine.
|
|
7
|
-
*/
|
|
8
|
-
export declare function buildSourceBundle(root: string): Promise<SourceBundle>;
|