create-cf-open-agents-api 0.2.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 +202 -0
- package/NOTICE +25 -0
- package/README.md +96 -0
- package/dist/answers.d.ts +30 -0
- package/dist/answers.js +83 -0
- package/dist/answers.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +31 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/doctor.d.ts +51 -0
- package/dist/commands/doctor.js +26 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +177 -0
- package/dist/commands/init.js +85 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/setup.d.ts +67 -0
- package/dist/commands/setup.js +31 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/vendor.d.ts +69 -0
- package/dist/commands/vendor.js +37 -0
- package/dist/commands/vendor.js.map +1 -0
- package/dist/doctor.d.ts +26 -0
- package/dist/doctor.js +136 -0
- package/dist/doctor.js.map +1 -0
- package/dist/exec.d.ts +16 -0
- package/dist/exec.js +33 -0
- package/dist/exec.js.map +1 -0
- package/dist/fs.d.ts +24 -0
- package/dist/fs.js +54 -0
- package/dist/fs.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +37 -0
- package/dist/init.js +179 -0
- package/dist/init.js.map +1 -0
- package/dist/jsonc.d.ts +17 -0
- package/dist/jsonc.js +55 -0
- package/dist/jsonc.js.map +1 -0
- package/dist/plan.d.ts +23 -0
- package/dist/plan.js +36 -0
- package/dist/plan.js.map +1 -0
- package/dist/project.d.ts +62 -0
- package/dist/project.js +52 -0
- package/dist/project.js.map +1 -0
- package/dist/setup.d.ts +26 -0
- package/dist/setup.js +139 -0
- package/dist/setup.js.map +1 -0
- package/dist/steps/agents-file.d.ts +5 -0
- package/dist/steps/agents-file.js +19 -0
- package/dist/steps/agents-file.js.map +1 -0
- package/dist/steps/dev-vars.d.ts +17 -0
- package/dist/steps/dev-vars.js +65 -0
- package/dist/steps/dev-vars.js.map +1 -0
- package/dist/steps/entry.d.ts +7 -0
- package/dist/steps/entry.js +36 -0
- package/dist/steps/entry.js.map +1 -0
- package/dist/steps/gitignore.d.ts +5 -0
- package/dist/steps/gitignore.js +20 -0
- package/dist/steps/gitignore.js.map +1 -0
- package/dist/steps/package-json.d.ts +12 -0
- package/dist/steps/package-json.js +45 -0
- package/dist/steps/package-json.js.map +1 -0
- package/dist/steps/standalone.d.ts +8 -0
- package/dist/steps/standalone.js +18 -0
- package/dist/steps/standalone.js.map +1 -0
- package/dist/steps/tsconfig.d.ts +4 -0
- package/dist/steps/tsconfig.js +18 -0
- package/dist/steps/tsconfig.js.map +1 -0
- package/dist/steps/vendor.d.ts +30 -0
- package/dist/steps/vendor.js +158 -0
- package/dist/steps/vendor.js.map +1 -0
- package/dist/steps/wrangler.d.ts +35 -0
- package/dist/steps/wrangler.js +197 -0
- package/dist/steps/wrangler.js.map +1 -0
- package/dist/templates/agents.d.ts +27 -0
- package/dist/templates/agents.js +265 -0
- package/dist/templates/agents.js.map +1 -0
- package/dist/templates/standalone.d.ts +12 -0
- package/dist/templates/standalone.js +44 -0
- package/dist/templates/standalone.js.map +1 -0
- package/dist/token.d.ts +3 -0
- package/dist/token.js +7 -0
- package/dist/token.js.map +1 -0
- package/dist/ui.d.ts +33 -0
- package/dist/ui.js +82 -0
- package/dist/ui.js.map +1 -0
- package/dist/vendor.d.ts +9 -0
- package/dist/vendor.js +14 -0
- package/dist/vendor.js.map +1 -0
- package/dist/versions.d.ts +30 -0
- package/dist/versions.js +33 -0
- package/dist/versions.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
export declare const initCommand: {
|
|
2
|
+
examples?: string | import("gunshi").CommandExamplesFetcher<import("gunshi").DefaultGunshiParams> | undefined;
|
|
3
|
+
toKebab?: boolean;
|
|
4
|
+
internal?: boolean;
|
|
5
|
+
entry?: boolean;
|
|
6
|
+
rendering?: import("gunshi").RenderingOptions<import("gunshi").DefaultGunshiParams> | undefined;
|
|
7
|
+
subCommands?: Record<string, import("gunshi").SubCommandable> | Map<string, import("gunshi").SubCommandable>;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
args: {
|
|
11
|
+
directory: {
|
|
12
|
+
type: "positional";
|
|
13
|
+
required: false;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
dir: {
|
|
17
|
+
type: "string";
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
yes: {
|
|
21
|
+
type: "boolean";
|
|
22
|
+
short: string;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
force: {
|
|
26
|
+
type: "boolean";
|
|
27
|
+
short: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
"dry-run": {
|
|
31
|
+
type: "boolean";
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
name: {
|
|
35
|
+
type: "string";
|
|
36
|
+
description: string;
|
|
37
|
+
};
|
|
38
|
+
provider: {
|
|
39
|
+
type: "enum";
|
|
40
|
+
choices: import("../templates/agents.js").Provider[];
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
"base-url": {
|
|
44
|
+
type: "string";
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
model: {
|
|
48
|
+
type: "string";
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
harnesses: {
|
|
52
|
+
type: "string";
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
"workers-ai": {
|
|
56
|
+
type: "boolean";
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
"code-loader": {
|
|
60
|
+
type: "boolean";
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
public: {
|
|
64
|
+
type: "boolean";
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
"agents-file": {
|
|
68
|
+
type: "string";
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
library: {
|
|
72
|
+
type: "string";
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
"cli-package": {
|
|
76
|
+
type: "string";
|
|
77
|
+
description: string;
|
|
78
|
+
};
|
|
79
|
+
ref: {
|
|
80
|
+
type: "string";
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
source: {
|
|
84
|
+
type: "string";
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
install: {
|
|
88
|
+
type: "boolean";
|
|
89
|
+
description: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
run: (ctx: Readonly<import("gunshi").CommandContext<{
|
|
93
|
+
args: {
|
|
94
|
+
directory: {
|
|
95
|
+
type: "positional";
|
|
96
|
+
required: false;
|
|
97
|
+
description: string;
|
|
98
|
+
};
|
|
99
|
+
dir: {
|
|
100
|
+
type: "string";
|
|
101
|
+
description: string;
|
|
102
|
+
};
|
|
103
|
+
yes: {
|
|
104
|
+
type: "boolean";
|
|
105
|
+
short: string;
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
force: {
|
|
109
|
+
type: "boolean";
|
|
110
|
+
short: string;
|
|
111
|
+
description: string;
|
|
112
|
+
};
|
|
113
|
+
"dry-run": {
|
|
114
|
+
type: "boolean";
|
|
115
|
+
description: string;
|
|
116
|
+
};
|
|
117
|
+
name: {
|
|
118
|
+
type: "string";
|
|
119
|
+
description: string;
|
|
120
|
+
};
|
|
121
|
+
provider: {
|
|
122
|
+
type: "enum";
|
|
123
|
+
choices: import("../templates/agents.js").Provider[];
|
|
124
|
+
description: string;
|
|
125
|
+
};
|
|
126
|
+
"base-url": {
|
|
127
|
+
type: "string";
|
|
128
|
+
description: string;
|
|
129
|
+
};
|
|
130
|
+
model: {
|
|
131
|
+
type: "string";
|
|
132
|
+
description: string;
|
|
133
|
+
};
|
|
134
|
+
harnesses: {
|
|
135
|
+
type: "string";
|
|
136
|
+
description: string;
|
|
137
|
+
};
|
|
138
|
+
"workers-ai": {
|
|
139
|
+
type: "boolean";
|
|
140
|
+
description: string;
|
|
141
|
+
};
|
|
142
|
+
"code-loader": {
|
|
143
|
+
type: "boolean";
|
|
144
|
+
description: string;
|
|
145
|
+
};
|
|
146
|
+
public: {
|
|
147
|
+
type: "boolean";
|
|
148
|
+
description: string;
|
|
149
|
+
};
|
|
150
|
+
"agents-file": {
|
|
151
|
+
type: "string";
|
|
152
|
+
description: string;
|
|
153
|
+
};
|
|
154
|
+
library: {
|
|
155
|
+
type: "string";
|
|
156
|
+
description: string;
|
|
157
|
+
};
|
|
158
|
+
"cli-package": {
|
|
159
|
+
type: "string";
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
ref: {
|
|
163
|
+
type: "string";
|
|
164
|
+
description: string;
|
|
165
|
+
};
|
|
166
|
+
source: {
|
|
167
|
+
type: "string";
|
|
168
|
+
description: string;
|
|
169
|
+
};
|
|
170
|
+
install: {
|
|
171
|
+
type: "boolean";
|
|
172
|
+
description: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
extensions: {};
|
|
176
|
+
}>>) => Promise<void>;
|
|
177
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { define } from "gunshi";
|
|
2
|
+
import { parseHarnesses, parseProvider } from "../answers.js";
|
|
3
|
+
import { runInit } from "../init.js";
|
|
4
|
+
import { HARNESSES, PROVIDERS } from "../templates/agents.js";
|
|
5
|
+
export const initCommand = define({
|
|
6
|
+
name: "init",
|
|
7
|
+
description: "Add the Agents API to the Workers project in a directory, or create a new one there (default command)",
|
|
8
|
+
args: {
|
|
9
|
+
directory: {
|
|
10
|
+
type: "positional",
|
|
11
|
+
required: false,
|
|
12
|
+
description: "Project directory (default: current directory)",
|
|
13
|
+
},
|
|
14
|
+
dir: { type: "string", description: "Project directory, as an option" },
|
|
15
|
+
yes: { type: "boolean", short: "y", description: "Accept every default without prompting" },
|
|
16
|
+
force: {
|
|
17
|
+
type: "boolean",
|
|
18
|
+
short: "f",
|
|
19
|
+
description: "Rewrite files and entries that differ from the template",
|
|
20
|
+
},
|
|
21
|
+
"dry-run": { type: "boolean", description: "Report what would change without writing" },
|
|
22
|
+
name: { type: "string", description: "Worker name when the configuration has none" },
|
|
23
|
+
provider: { type: "enum", choices: [...PROVIDERS], description: "Model provider" },
|
|
24
|
+
"base-url": { type: "string", description: "openai-compatible: Chat Completions base URL" },
|
|
25
|
+
model: { type: "string", description: "openai-compatible: model id" },
|
|
26
|
+
harnesses: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: `Comma-separated runtimes (${HARNESSES.join(", ")})`,
|
|
29
|
+
},
|
|
30
|
+
"workers-ai": {
|
|
31
|
+
type: "boolean",
|
|
32
|
+
description: "Also add the Workers AI preset and the AI binding",
|
|
33
|
+
},
|
|
34
|
+
"code-loader": {
|
|
35
|
+
type: "boolean",
|
|
36
|
+
description: "Programmatic tool calling through Dynamic Workers (--no-code-loader disables it)",
|
|
37
|
+
},
|
|
38
|
+
public: { type: "boolean", description: "New project: publish the HTTP API on workers.dev" },
|
|
39
|
+
"agents-file": {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Path of the composition module (default: next to the entry)",
|
|
42
|
+
},
|
|
43
|
+
library: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "Pre-publication: cf-open-agents-api tarball or directory for a file: dependency",
|
|
46
|
+
},
|
|
47
|
+
"cli-package": {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Pre-publication: this CLI's tarball or directory for the postinstall hook",
|
|
50
|
+
},
|
|
51
|
+
ref: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Git ref of the image snapshot (default: v<this version>)",
|
|
54
|
+
},
|
|
55
|
+
source: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Local repository checkout to snapshot instead of downloading",
|
|
58
|
+
},
|
|
59
|
+
install: { type: "boolean", description: "Run the package manager install afterwards" },
|
|
60
|
+
},
|
|
61
|
+
run: async (ctx) => {
|
|
62
|
+
const values = ctx.values;
|
|
63
|
+
await runInit({
|
|
64
|
+
dir: values.dir ?? values.directory ?? process.cwd(),
|
|
65
|
+
yes: Boolean(values.yes),
|
|
66
|
+
force: Boolean(values.force),
|
|
67
|
+
dryRun: Boolean(values["dry-run"]),
|
|
68
|
+
name: values.name,
|
|
69
|
+
provider: values.provider === undefined ? undefined : parseProvider(values.provider),
|
|
70
|
+
baseURL: values["base-url"],
|
|
71
|
+
model: values.model,
|
|
72
|
+
harnesses: values.harnesses === undefined ? undefined : parseHarnesses(values.harnesses),
|
|
73
|
+
workersAi: values["workers-ai"],
|
|
74
|
+
codeLoader: values["code-loader"],
|
|
75
|
+
publicRoute: values.public,
|
|
76
|
+
agentsFile: values["agents-file"],
|
|
77
|
+
library: values.library,
|
|
78
|
+
cliPackage: values["cli-package"],
|
|
79
|
+
ref: values.ref,
|
|
80
|
+
source: values.source,
|
|
81
|
+
install: values.install,
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC;IAChC,IAAI,EAAE,MAAM;IACZ,WAAW,EACT,uGAAuG;IACzG,IAAI,EAAE;QACJ,SAAS,EAAE;YACT,IAAI,EAAE,YAAY;YAClB,QA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O;YACvB,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC;YACjC,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const setupCommand: {
|
|
2
|
+
examples?: string | import("gunshi").CommandExamplesFetcher<import("gunshi").DefaultGunshiParams> | undefined;
|
|
3
|
+
toKebab?: boolean;
|
|
4
|
+
internal?: boolean;
|
|
5
|
+
entry?: boolean;
|
|
6
|
+
rendering?: import("gunshi").RenderingOptions<import("gunshi").DefaultGunshiParams> | undefined;
|
|
7
|
+
subCommands?: Record<string, import("gunshi").SubCommandable> | Map<string, import("gunshi").SubCommandable>;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
args: {
|
|
11
|
+
directory: {
|
|
12
|
+
type: "positional";
|
|
13
|
+
required: false;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
dir: {
|
|
17
|
+
type: "string";
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
"dry-run": {
|
|
21
|
+
type: "boolean";
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
"from-env": {
|
|
25
|
+
type: "boolean";
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
"skip-secrets": {
|
|
29
|
+
type: "boolean";
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
"skip-buckets": {
|
|
33
|
+
type: "boolean";
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
run: (ctx: Readonly<import("gunshi").CommandContext<{
|
|
38
|
+
args: {
|
|
39
|
+
directory: {
|
|
40
|
+
type: "positional";
|
|
41
|
+
required: false;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
dir: {
|
|
45
|
+
type: "string";
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
"dry-run": {
|
|
49
|
+
type: "boolean";
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
"from-env": {
|
|
53
|
+
type: "boolean";
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
"skip-secrets": {
|
|
57
|
+
type: "boolean";
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
"skip-buckets": {
|
|
61
|
+
type: "boolean";
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
extensions: {};
|
|
66
|
+
}>>) => Promise<void>;
|
|
67
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { define } from "gunshi";
|
|
2
|
+
import { runSetup } from "../setup.js";
|
|
3
|
+
export const setupCommand = define({
|
|
4
|
+
name: "setup",
|
|
5
|
+
description: "Production provisioning: create the R2 buckets and put the secrets with wrangler",
|
|
6
|
+
args: {
|
|
7
|
+
directory: {
|
|
8
|
+
type: "positional",
|
|
9
|
+
required: false,
|
|
10
|
+
description: "Project directory (default: current directory)",
|
|
11
|
+
},
|
|
12
|
+
dir: { type: "string", description: "Project directory, as an option" },
|
|
13
|
+
"dry-run": { type: "boolean", description: "Print the wrangler commands without running them" },
|
|
14
|
+
"from-env": {
|
|
15
|
+
type: "boolean",
|
|
16
|
+
description: "Read secret values from environment variables instead of prompting",
|
|
17
|
+
},
|
|
18
|
+
"skip-secrets": { type: "boolean", description: "Do not put secrets" },
|
|
19
|
+
"skip-buckets": { type: "boolean", description: "Do not create buckets" },
|
|
20
|
+
},
|
|
21
|
+
run: async (ctx) => {
|
|
22
|
+
await runSetup({
|
|
23
|
+
dir: ctx.values.dir ?? ctx.values.directory ?? process.cwd(),
|
|
24
|
+
dryRun: Boolean(ctx.values["dry-run"]),
|
|
25
|
+
fromEnv: Boolean(ctx.values["from-env"]),
|
|
26
|
+
skipSecrets: Boolean(ctx.values["skip-secrets"]),
|
|
27
|
+
skipBuckets: Boolean(ctx.values["skip-buckets"]),
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;IACjC,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,kFAAkF;IAC/F,IAAI,EAAE;QACJ,SAAS,EAAE;YACT,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,gDAAgD;SAC9D;QACD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iCAAiC,EAAE;QACvE,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,kDAAkD,EAAE;QAC/F,UAAU,EAAE;YACV,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,oEAAoE;SAClF;QACD,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE;QACtE,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,uBAAuB,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACjB,MAAM,QAAQ,CAAC;YACb,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE;YAC5D,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACtC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACxC,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;YAChD,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;SACjD,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export declare const vendorCommand: {
|
|
2
|
+
examples?: string | import("gunshi").CommandExamplesFetcher<import("gunshi").DefaultGunshiParams> | undefined;
|
|
3
|
+
toKebab?: boolean;
|
|
4
|
+
internal?: boolean;
|
|
5
|
+
entry?: boolean;
|
|
6
|
+
rendering?: import("gunshi").RenderingOptions<import("gunshi").DefaultGunshiParams> | undefined;
|
|
7
|
+
subCommands?: Record<string, import("gunshi").SubCommandable> | Map<string, import("gunshi").SubCommandable>;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
args: {
|
|
11
|
+
directory: {
|
|
12
|
+
type: "positional";
|
|
13
|
+
required: false;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
dir: {
|
|
17
|
+
type: "string";
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
ref: {
|
|
21
|
+
type: "string";
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
source: {
|
|
25
|
+
type: "string";
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
force: {
|
|
29
|
+
type: "boolean";
|
|
30
|
+
short: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
"dry-run": {
|
|
34
|
+
type: "boolean";
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
run: (ctx: Readonly<import("gunshi").CommandContext<{
|
|
39
|
+
args: {
|
|
40
|
+
directory: {
|
|
41
|
+
type: "positional";
|
|
42
|
+
required: false;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
dir: {
|
|
46
|
+
type: "string";
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
ref: {
|
|
50
|
+
type: "string";
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
source: {
|
|
54
|
+
type: "string";
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
force: {
|
|
58
|
+
type: "boolean";
|
|
59
|
+
short: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
"dry-run": {
|
|
63
|
+
type: "boolean";
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
extensions: {};
|
|
68
|
+
}>>) => Promise<void>;
|
|
69
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { define } from "gunshi";
|
|
2
|
+
import { plainReporter } from "../ui.js";
|
|
3
|
+
import { runVendor } from "../vendor.js";
|
|
4
|
+
export const vendorCommand = define({
|
|
5
|
+
name: "vendor",
|
|
6
|
+
description: "Refresh the .cf-open-agents-api image snapshot (also the postinstall hook)",
|
|
7
|
+
args: {
|
|
8
|
+
directory: {
|
|
9
|
+
type: "positional",
|
|
10
|
+
required: false,
|
|
11
|
+
description: "Project directory (default: current directory)",
|
|
12
|
+
},
|
|
13
|
+
dir: { type: "string", description: "Project directory, as an option" },
|
|
14
|
+
ref: { type: "string", description: "Git ref to snapshot (default: v<this version>)" },
|
|
15
|
+
source: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Local repository checkout to snapshot instead of downloading",
|
|
18
|
+
},
|
|
19
|
+
force: {
|
|
20
|
+
type: "boolean",
|
|
21
|
+
short: "f",
|
|
22
|
+
description: "Rebuild the snapshot even when it is current",
|
|
23
|
+
},
|
|
24
|
+
"dry-run": { type: "boolean", description: "Report without writing" },
|
|
25
|
+
},
|
|
26
|
+
run: async (ctx) => {
|
|
27
|
+
const result = await runVendor({
|
|
28
|
+
dir: ctx.values.dir ?? ctx.values.directory ?? process.cwd(),
|
|
29
|
+
ref: ctx.values.ref,
|
|
30
|
+
source: ctx.values.source,
|
|
31
|
+
force: Boolean(ctx.values.force),
|
|
32
|
+
dryRun: Boolean(ctx.values["dry-run"]),
|
|
33
|
+
});
|
|
34
|
+
plainReporter().info(`Image snapshot ${result.status}${result.note ? `: ${result.note}` : ""}`);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=vendor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor.js","sourceRoot":"","sources":["../../src/commands/vendor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;IAClC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,4EAA4E;IACzF,IAAI,EAAE;QACJ,SAAS,EAAE;YACT,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,gDAAgD;SAC9D;QACD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iCAAiC,EAAE;QACvE,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gDAAgD,EAAE;QACtF,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,8DAA8D;SAC5E;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,8CAA8C;SAC5D;QACD,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,wBAAwB,EAAE;KACtE;IACD,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACjB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC;YAC7B,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE;YAC5D,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG;YACnB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM;YACzB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;YAChC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SACvC,CAAC,CAAC;QACH,aAAa,EAAE,CAAC,IAAI,CAAC,kBAAkB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClG,CAAC;CACF,CAAC,CAAC"}
|
package/dist/doctor.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Runner } from "./exec.js";
|
|
2
|
+
import { type WranglerConfig } from "./project.js";
|
|
3
|
+
import { type VendorManifest } from "./steps/vendor.js";
|
|
4
|
+
export interface Check {
|
|
5
|
+
name: string;
|
|
6
|
+
ok: boolean;
|
|
7
|
+
detail: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DoctorOptions {
|
|
10
|
+
dir: string;
|
|
11
|
+
runner?: Runner;
|
|
12
|
+
cliVersion?: string;
|
|
13
|
+
/** Skip the checks that call docker and wrangler. */
|
|
14
|
+
offline?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface DoctorReport {
|
|
17
|
+
checks: Check[];
|
|
18
|
+
ok: boolean;
|
|
19
|
+
notes: string[];
|
|
20
|
+
}
|
|
21
|
+
/** Agreement rules the Worker breaks silently when they drift; mirrors the repository's check:docs. */
|
|
22
|
+
export declare function configChecks(config: WranglerConfig): Check[];
|
|
23
|
+
export declare function snapshotCheck(manifest: VendorManifest | undefined, cliVersion: string): Check;
|
|
24
|
+
export declare function devVarsCheck(text: string | undefined): Check;
|
|
25
|
+
export declare function runDoctor(options: DoctorOptions): DoctorReport;
|
|
26
|
+
export declare function renderReport(report: DoctorReport): string;
|
package/dist/doctor.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { join, resolve } from "node:path";
|
|
2
|
+
import { packageManagerExec, run } from "./exec.js";
|
|
3
|
+
import { readIfExists } from "./fs.js";
|
|
4
|
+
import { parseJsonc } from "./jsonc.js";
|
|
5
|
+
import { locateProject } from "./project.js";
|
|
6
|
+
import { parseDevVars } from "./steps/dev-vars.js";
|
|
7
|
+
import { readVendorManifest } from "./steps/vendor.js";
|
|
8
|
+
import { BUCKETS, CONTAINERS, DURABLE_OBJECTS } from "./steps/wrangler.js";
|
|
9
|
+
import { MINIMUM_TOKEN_LENGTH } from "./token.js";
|
|
10
|
+
import { CLI_VERSION, CTX_EXPORTS_DATE, TOOLCHAIN_VERSIONS } from "./versions.js";
|
|
11
|
+
const check = (name, ok, detail) => ({ name, ok, detail });
|
|
12
|
+
const serviceCheck = (config, binding, entrypoint) => {
|
|
13
|
+
const name = config.name ?? "";
|
|
14
|
+
const entry = config.services?.find((item) => item.binding === binding);
|
|
15
|
+
if (!entry)
|
|
16
|
+
return check(`services.${binding}`, false, "missing");
|
|
17
|
+
const ok = entry.service === name && entry.entrypoint === entrypoint;
|
|
18
|
+
const found = `${entry.service ?? "?"}#${entry.entrypoint ?? "default"}`;
|
|
19
|
+
return check(`services.${binding}`, ok, ok ? `→ ${found}` : `points at ${found}, expected ${name}#${entrypoint}`);
|
|
20
|
+
};
|
|
21
|
+
function storageChecks(config) {
|
|
22
|
+
const backup = config.r2_buckets?.find((bucket) => bucket.binding === "BACKUP_BUCKET")?.bucket_name;
|
|
23
|
+
const variable = config.vars?.BACKUP_BUCKET_NAME;
|
|
24
|
+
const checks = [
|
|
25
|
+
check("vars.BACKUP_BUCKET_NAME", backup !== undefined && variable === backup, backup === undefined
|
|
26
|
+
? "BACKUP_BUCKET binding missing"
|
|
27
|
+
: `${JSON.stringify(variable)} vs bucket ${backup}`),
|
|
28
|
+
];
|
|
29
|
+
for (const bucket of BUCKETS) {
|
|
30
|
+
const present = config.r2_buckets?.some((entry) => entry.binding === bucket.binding) ?? false;
|
|
31
|
+
checks.push(check(`r2_buckets.${bucket.binding}`, present, present ? "" : "missing"));
|
|
32
|
+
}
|
|
33
|
+
return checks;
|
|
34
|
+
}
|
|
35
|
+
function objectChecks(config) {
|
|
36
|
+
const checks = [];
|
|
37
|
+
for (const object of DURABLE_OBJECTS) {
|
|
38
|
+
const binding = config.durable_objects?.bindings?.find((entry) => entry.name === object.name);
|
|
39
|
+
const ok = binding?.class_name === object.class_name;
|
|
40
|
+
checks.push(check(`durable_objects.${object.name}`, ok, binding ? `class ${binding.class_name ?? "?"}` : "missing"));
|
|
41
|
+
const sqlite = config.migrations?.some((migration) => migration.new_sqlite_classes?.includes(object.class_name)) ?? false;
|
|
42
|
+
checks.push(check(`migrations.${object.class_name}`, sqlite, sqlite ? "new_sqlite_classes" : "not in new_sqlite_classes"));
|
|
43
|
+
}
|
|
44
|
+
return checks;
|
|
45
|
+
}
|
|
46
|
+
function containerChecks(config) {
|
|
47
|
+
return CONTAINERS.map((container) => {
|
|
48
|
+
const entry = config.containers?.find((item) => item.class_name === container.class_name);
|
|
49
|
+
const ok = entry?.image === container.image;
|
|
50
|
+
return check(`containers.${container.class_name}`, ok, entry ? `image ${entry.image ?? "?"}` : "missing");
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function flagChecks(config) {
|
|
54
|
+
const flags = config.compatibility_flags ?? [];
|
|
55
|
+
const checks = [check("compatibility_flags.nodejs_compat", flags.includes("nodejs_compat"), "")];
|
|
56
|
+
if ((config.compatibility_date ?? "") < CTX_EXPORTS_DATE)
|
|
57
|
+
checks.push(check("compatibility_flags.enable_ctx_exports", flags.includes("enable_ctx_exports"), `compatibility_date ${config.compatibility_date ?? "?"} is before ${CTX_EXPORTS_DATE}`));
|
|
58
|
+
return checks;
|
|
59
|
+
}
|
|
60
|
+
/** Agreement rules the Worker breaks silently when they drift; mirrors the repository's check:docs. */
|
|
61
|
+
export function configChecks(config) {
|
|
62
|
+
const name = config.name ?? "";
|
|
63
|
+
const checks = [
|
|
64
|
+
check("name", name.length > 0, name || "missing"),
|
|
65
|
+
serviceCheck(config, "MODEL_GATEWAY", "Models"),
|
|
66
|
+
];
|
|
67
|
+
// A standalone Worker serves the API as its default export and has no AGENTS binding.
|
|
68
|
+
if (config.services?.some((item) => item.binding === "AGENTS"))
|
|
69
|
+
checks.push(serviceCheck(config, "AGENTS", "Agents"));
|
|
70
|
+
return [
|
|
71
|
+
...checks,
|
|
72
|
+
...storageChecks(config),
|
|
73
|
+
...objectChecks(config),
|
|
74
|
+
...containerChecks(config),
|
|
75
|
+
...flagChecks(config),
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
export function snapshotCheck(manifest, cliVersion) {
|
|
79
|
+
if (!manifest)
|
|
80
|
+
return check("image snapshot", false, "missing; run create-cf-open-agents-api vendor");
|
|
81
|
+
return check("image snapshot", manifest.version === cliVersion, `${manifest.version} (CLI ${cliVersion})`);
|
|
82
|
+
}
|
|
83
|
+
export function devVarsCheck(text) {
|
|
84
|
+
const token = text ? (parseDevVars(text).get("API_TOKEN") ?? "") : "";
|
|
85
|
+
return check(".dev.vars API_TOKEN", token.length >= MINIMUM_TOKEN_LENGTH, text ? `${token.length} characters` : "file missing");
|
|
86
|
+
}
|
|
87
|
+
function toolChecks(project, runner) {
|
|
88
|
+
const exec = packageManagerExec(project.packageManager);
|
|
89
|
+
const wrangler = runner(exec[0] ?? "npx", [...exec.slice(1), "wrangler", "--version"], {
|
|
90
|
+
cwd: project.root,
|
|
91
|
+
});
|
|
92
|
+
const version = /(\d+\.\d+\.\d+)/.exec(wrangler.stdout)?.[1];
|
|
93
|
+
const docker = runner("docker", ["info"], { cwd: project.root });
|
|
94
|
+
const whoami = runner(exec[0] ?? "npx", [...exec.slice(1), "wrangler", "whoami"], {
|
|
95
|
+
cwd: project.root,
|
|
96
|
+
});
|
|
97
|
+
const loggedIn = whoami.ok && !/not authenticated|not logged in/i.test(whoami.stdout + whoami.stderr);
|
|
98
|
+
return [
|
|
99
|
+
check("wrangler", wrangler.ok && version !== undefined, version
|
|
100
|
+
? `${version} (this CLI was tested with ${TOOLCHAIN_VERSIONS.wrangler})`
|
|
101
|
+
: "not installed"),
|
|
102
|
+
check("docker", docker.ok, docker.ok ? "engine reachable" : "docker info failed; local containers need a running engine"),
|
|
103
|
+
check("wrangler login", loggedIn, loggedIn
|
|
104
|
+
? "authenticated"
|
|
105
|
+
: "run wrangler login (the AI binding calls your account even in wrangler dev)"),
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
export function runDoctor(options) {
|
|
109
|
+
const root = resolve(options.dir);
|
|
110
|
+
const project = locateProject(root);
|
|
111
|
+
const runner = options.runner ?? run;
|
|
112
|
+
const major = Number(process.versions.node.split(".")[0]);
|
|
113
|
+
const checks = [check("node", major >= 24, process.versions.node)];
|
|
114
|
+
const text = readIfExists(project.configPath);
|
|
115
|
+
if (project.mode === "standalone" || text === undefined)
|
|
116
|
+
checks.push(check("wrangler config", false, "no wrangler.jsonc; run create-cf-open-agents-api init"));
|
|
117
|
+
else
|
|
118
|
+
checks.push(...configChecks(parseJsonc(text, project.configPath)));
|
|
119
|
+
checks.push(snapshotCheck(readVendorManifest(root), options.cliVersion ?? CLI_VERSION));
|
|
120
|
+
checks.push(devVarsCheck(readIfExists(join(root, ".dev.vars"))));
|
|
121
|
+
if (!options.offline)
|
|
122
|
+
checks.push(...toolChecks(project, runner));
|
|
123
|
+
return {
|
|
124
|
+
checks,
|
|
125
|
+
ok: checks.every((item) => item.ok),
|
|
126
|
+
notes: [
|
|
127
|
+
"Containers need the Workers Paid plan; deployment fails without it.",
|
|
128
|
+
"Named environments (env.*) are not checked.",
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export function renderReport(report) {
|
|
133
|
+
const lines = report.checks.map((item) => `${item.ok ? "✔" : "✖"} ${item.name}${item.detail ? ` ${item.detail}` : ""}`);
|
|
134
|
+
return [...lines, "", ...report.notes.map((note) => ` - ${note}`)].join("\n");
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAe,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAqC,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAoBlF,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAW,EAAE,MAAc,EAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAE3F,MAAM,YAAY,GAAG,CAAC,MAAsB,EAAE,OAAe,EAAE,UAAkB,EAAS,EAAE;IAC1F,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,E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