vibes-diy 14.3.445 → 14.3.447
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/cli/cli-ctx.d.ts +1 -0
- package/cli/cmd-evento.d.ts +247 -167
- package/cli/cmd-evento.js +3 -1
- package/cli/cmds/agent-cmd.d.ts +8 -0
- package/cli/cmds/agent-cmd.js +13 -0
- package/cli/cmds/anon-write-follow-notice.d.ts +2 -0
- package/cli/cmds/anon-write-follow-notice.js +18 -0
- package/cli/cmds/app/anon-write-cmd.js +1 -1
- package/cli/cmds/app/call-cmd.d.ts +10 -0
- package/cli/cmds/app/call-cmd.js +36 -4
- package/cli/cmds/app/index.d.ts +29 -0
- package/cli/cmds/app/index.js +4 -1
- package/cli/cmds/app/rearm-cmd.d.ts +2 -0
- package/cli/cmds/app/rearm-cmd.js +9 -2
- package/cli/cmds/app/schedule-cmd.d.ts +2 -0
- package/cli/cmds/app/schedule-cmd.js +21 -4
- package/cli/cmds/app/status-cmd.d.ts +4 -0
- package/cli/cmds/app/status-cmd.js +25 -1
- package/cli/cmds/app/tools-cmd.d.ts +141 -0
- package/cli/cmds/app/tools-cmd.js +279 -0
- package/cli/cmds/push-from-dir.js +9 -1
- package/cli/cmds/run/backend-worker/run-backend-entry.js +1253 -230
- package/cli/cmds/run/bundle-inputs.json +37 -1
- package/cli/cmds/run/run-bundle.js +11808 -7373
- package/cli/main.js +25 -1
- package/package.json +24 -12
|
@@ -127,7 +127,7 @@ export function parseAnonWriteWord(raw) {
|
|
|
127
127
|
export function appAnonWriteCmd(ctx) {
|
|
128
128
|
return command({
|
|
129
129
|
name: "anon-write",
|
|
130
|
-
description: "Read or set whether signed-out visitors' writes from their browser reach the server (owner, or a developer they delegated); writes the app's own backend.js makes need only access.js's `allowAnonymous`. `on` admits them wherever access.js allows it; `off` keeps them on the visitor's device. No argument reads.
|
|
130
|
+
description: "Read or set whether signed-out visitors' writes from their browser reach the server (owner, or a developer they delegated); writes the app's own backend.js makes need only access.js's `allowAnonymous`. `on` admits them wherever access.js allows it; `off` keeps them on the visitor's device. No argument reads. Until you set it, an open app follows a literal `allowAnonymous: true` in the access.js each production push releases, and push prints a line when that changes it.",
|
|
131
131
|
args: {
|
|
132
132
|
...cmdTsDefaultArgs(ctx),
|
|
133
133
|
appSlug: positional({
|
|
@@ -33,6 +33,14 @@ export declare function checkAppCall(input: {
|
|
|
33
33
|
path: string;
|
|
34
34
|
body: string;
|
|
35
35
|
}>;
|
|
36
|
+
export declare function appCallTarget(input: {
|
|
37
|
+
readonly word: string;
|
|
38
|
+
readonly method: string;
|
|
39
|
+
readonly body: string;
|
|
40
|
+
readonly input: string;
|
|
41
|
+
}): Result<{
|
|
42
|
+
readonly kind: "tool" | "route";
|
|
43
|
+
}>;
|
|
36
44
|
export declare function renderAppCallLines(msg: ResAppCallCli): string[];
|
|
37
45
|
export declare const appCallEvento: EventoHandler<WrapCmdTSMsg<unknown>, ReqAppCall, ResAppCallCli>;
|
|
38
46
|
export declare function appCallCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
@@ -44,6 +52,7 @@ export declare function appCallCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs
|
|
|
44
52
|
path: string | undefined;
|
|
45
53
|
method: string;
|
|
46
54
|
body: string;
|
|
55
|
+
input: string;
|
|
47
56
|
vibe: string;
|
|
48
57
|
handle: string;
|
|
49
58
|
}>>;
|
|
@@ -55,6 +64,7 @@ export declare function appCallCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs
|
|
|
55
64
|
path: string | undefined;
|
|
56
65
|
method: string;
|
|
57
66
|
body: string;
|
|
67
|
+
input: string;
|
|
58
68
|
vibe: string;
|
|
59
69
|
handle: string;
|
|
60
70
|
}, never> & {
|
package/cli/cmds/app/call-cmd.js
CHANGED
|
@@ -9,6 +9,7 @@ import { resolveVibePositionals } from "../../parse-vibe.js";
|
|
|
9
9
|
import { formatErr } from "../format-err.js";
|
|
10
10
|
import { HANDLE_REQUIRED_CLI_MESSAGE } from "../../handle-required.js";
|
|
11
11
|
import { HANDLE_FLAG_HELP, VIBE_FLAG_HELP, VIBE_POSITIONAL_HELP } from "../../vibe-arg-help.js";
|
|
12
|
+
import { isAppToolName } from "./tools-cmd.js";
|
|
12
13
|
export const ReqAppCall = type({
|
|
13
14
|
type: "'vibes-diy.cli.app-call'",
|
|
14
15
|
appSlug: "string",
|
|
@@ -47,6 +48,17 @@ export function checkAppCall(input) {
|
|
|
47
48
|
}
|
|
48
49
|
return Result.Ok({ method, path, body: input.body });
|
|
49
50
|
}
|
|
51
|
+
export function appCallTarget(input) {
|
|
52
|
+
const routeFlags = input.body !== "" || (input.method !== "" && input.method.toUpperCase() !== "POST");
|
|
53
|
+
if (isAppToolName(input.word) && !routeFlags)
|
|
54
|
+
return Result.Ok({ kind: "tool" });
|
|
55
|
+
if (input.input !== "") {
|
|
56
|
+
return Result.Err(isAppToolName(input.word)
|
|
57
|
+
? "A tool takes --input only; --body and --method are for a route (start it with /)."
|
|
58
|
+
: `--input is for a tool, named in lower snake case (e.g. book_slot). A route like ${input.word} takes --body.`);
|
|
59
|
+
}
|
|
60
|
+
return Result.Ok({ kind: "route" });
|
|
61
|
+
}
|
|
50
62
|
export function renderAppCallLines(msg) {
|
|
51
63
|
const lines = [`${msg.method} ${msg.ownerHandle}/${msg.appSlug}${msg.path} → ${msg.status}`];
|
|
52
64
|
if (msg.body !== "")
|
|
@@ -107,7 +119,7 @@ export const appCallEvento = {
|
|
|
107
119
|
export function appCallCmd(ctx) {
|
|
108
120
|
return command({
|
|
109
121
|
name: "call",
|
|
110
|
-
description: "Call one of a vibe's own backend.js routes as you, signed in — the same call the app's own buttons make.
|
|
122
|
+
description: "Call one of a vibe's own backend.js routes (/path) or tools (a tool name, with --input) as you, signed in — the same call the app's own buttons make. A tool its maker marked to ask about first runs only after you answer y at the terminal. Prints the answer; exits 1 on a non-2xx answer or a tool that did not answer ok.",
|
|
111
123
|
args: {
|
|
112
124
|
...cmdTsDefaultArgs(ctx),
|
|
113
125
|
appSlug: positional({
|
|
@@ -116,8 +128,8 @@ export function appCallCmd(ctx) {
|
|
|
116
128
|
type: optional(string),
|
|
117
129
|
}),
|
|
118
130
|
path: positional({
|
|
119
|
-
displayName: "
|
|
120
|
-
description: "
|
|
131
|
+
displayName: "route-or-tool",
|
|
132
|
+
description: "A route, relative to the app's /_api root (e.g. /go-live), or one of its tools by name (e.g. book_slot; see app tools).",
|
|
121
133
|
type: optional(string),
|
|
122
134
|
}),
|
|
123
135
|
method: option({
|
|
@@ -135,6 +147,13 @@ export function appCallCmd(ctx) {
|
|
|
135
147
|
defaultValue: () => "",
|
|
136
148
|
defaultValueIsSerializable: true,
|
|
137
149
|
}),
|
|
150
|
+
input: option({
|
|
151
|
+
long: "input",
|
|
152
|
+
description: `A tool's input, as one JSON object (e.g. '{"day":"Thu"}'). Default {}.`,
|
|
153
|
+
type: string,
|
|
154
|
+
defaultValue: () => "",
|
|
155
|
+
defaultValueIsSerializable: true,
|
|
156
|
+
}),
|
|
138
157
|
vibe: option({
|
|
139
158
|
long: "vibe",
|
|
140
159
|
description: VIBE_FLAG_HELP,
|
|
@@ -154,7 +173,20 @@ export function appCallCmd(ctx) {
|
|
|
154
173
|
const resolved = resolveVibePositionals({ vibe: args.vibe, handle: args.handle, positionals: [args.appSlug, args.path] });
|
|
155
174
|
const path = resolved.trailing[0] ?? "";
|
|
156
175
|
if (path === "") {
|
|
157
|
-
throw new Error("Missing route
|
|
176
|
+
throw new Error("Missing route or tool — e.g. vibes-diy app call handle/app-slug /go-live, or a tool name from app tools");
|
|
177
|
+
}
|
|
178
|
+
const rTarget = appCallTarget({ word: path, method: args.method, body: args.body, input: args.input });
|
|
179
|
+
if (rTarget.isErr())
|
|
180
|
+
throw new Error(rTarget.Err().message);
|
|
181
|
+
if (rTarget.Ok().kind === "tool") {
|
|
182
|
+
return {
|
|
183
|
+
type: "vibes-diy.cli.app-call-tool",
|
|
184
|
+
appSlug: resolved.appSlug,
|
|
185
|
+
ownerHandle: resolved.handle,
|
|
186
|
+
apiUrl: args.apiUrl,
|
|
187
|
+
tool: path,
|
|
188
|
+
input: args.input,
|
|
189
|
+
};
|
|
158
190
|
}
|
|
159
191
|
return {
|
|
160
192
|
type: "vibes-diy.cli.app-call",
|
package/cli/cmds/app/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { appLookEvento, isResAppLookCli, renderAppLookLines, appLookFromSettings
|
|
|
9
9
|
export { appAnonWriteEvento, isResAppAnonWriteCli, renderAppAnonWriteLines, type ResAppAnonWriteCli } from "./anon-write-cmd.js";
|
|
10
10
|
export { appAutoEnhanceEvento, isResAppAutoEnhanceCli, renderAppAutoEnhanceLines, type ResAppAutoEnhanceCli, } from "./auto-enhance-cmd.js";
|
|
11
11
|
export { appCallEvento, isResAppCallCli, renderAppCallLines, type ResAppCallCli } from "./call-cmd.js";
|
|
12
|
+
export { appToolsEvento, appCallToolEvento, isResAppToolsCli, isResAppCallToolCli, renderAppToolsLines, renderAppCallToolLines, type ResAppToolsCli, type ResAppCallToolCli, } from "./tools-cmd.js";
|
|
12
13
|
export { appScreenshotEvento, isResAppScreenshotCli, renderAppScreenshotLines, type ResAppScreenshotCli, } from "./screenshot-cmd.js";
|
|
13
14
|
export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
14
15
|
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
@@ -43,6 +44,7 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
43
44
|
path: string | undefined;
|
|
44
45
|
method: string;
|
|
45
46
|
body: string;
|
|
47
|
+
input: string;
|
|
46
48
|
vibe: string;
|
|
47
49
|
handle: string;
|
|
48
50
|
};
|
|
@@ -167,6 +169,16 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
167
169
|
handle: string;
|
|
168
170
|
at: string;
|
|
169
171
|
};
|
|
172
|
+
} | {
|
|
173
|
+
command: "tools";
|
|
174
|
+
args: {
|
|
175
|
+
apiUrl: string;
|
|
176
|
+
json: boolean;
|
|
177
|
+
text: boolean;
|
|
178
|
+
appSlug: string | undefined;
|
|
179
|
+
vibe: string;
|
|
180
|
+
handle: string;
|
|
181
|
+
};
|
|
170
182
|
}>>;
|
|
171
183
|
} & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
|
|
172
184
|
command: "anon-write";
|
|
@@ -200,6 +212,7 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
200
212
|
path: string | undefined;
|
|
201
213
|
method: string;
|
|
202
214
|
body: string;
|
|
215
|
+
input: string;
|
|
203
216
|
vibe: string;
|
|
204
217
|
handle: string;
|
|
205
218
|
};
|
|
@@ -324,6 +337,16 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
324
337
|
handle: string;
|
|
325
338
|
at: string;
|
|
326
339
|
};
|
|
340
|
+
} | {
|
|
341
|
+
command: "tools";
|
|
342
|
+
args: {
|
|
343
|
+
apiUrl: string;
|
|
344
|
+
json: boolean;
|
|
345
|
+
text: boolean;
|
|
346
|
+
appSlug: string | undefined;
|
|
347
|
+
vibe: string;
|
|
348
|
+
handle: string;
|
|
349
|
+
};
|
|
327
350
|
}, {
|
|
328
351
|
command: "anon-write";
|
|
329
352
|
value: never;
|
|
@@ -366,6 +389,9 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
366
389
|
} | {
|
|
367
390
|
command: "tick";
|
|
368
391
|
value: never;
|
|
392
|
+
} | {
|
|
393
|
+
command: "tools";
|
|
394
|
+
value: never;
|
|
369
395
|
}> & {
|
|
370
396
|
run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
371
397
|
command: "anon-write";
|
|
@@ -409,5 +435,8 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
409
435
|
} | {
|
|
410
436
|
command: "tick";
|
|
411
437
|
value: never;
|
|
438
|
+
} | {
|
|
439
|
+
command: "tools";
|
|
440
|
+
value: never;
|
|
412
441
|
}>>;
|
|
413
442
|
};
|
package/cli/cmds/app/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { appLookCmd } from "./look-cmd.js";
|
|
|
10
10
|
import { appAnonWriteCmd } from "./anon-write-cmd.js";
|
|
11
11
|
import { appAutoEnhanceCmd } from "./auto-enhance-cmd.js";
|
|
12
12
|
import { appCallCmd } from "./call-cmd.js";
|
|
13
|
+
import { appToolsCmd } from "./tools-cmd.js";
|
|
13
14
|
export { appStatusEvento, isResAppStatusCli, renderAppStatusLines } from "./status-cmd.js";
|
|
14
15
|
export { appRearmEvento, isResAppRearmCli, renderAppRearmLines } from "./rearm-cmd.js";
|
|
15
16
|
export { appTickEvento, isResAppTickCli, renderAppTickLines } from "./tick-cmd.js";
|
|
@@ -20,11 +21,12 @@ export { appLookEvento, isResAppLookCli, renderAppLookLines, appLookFromSettings
|
|
|
20
21
|
export { appAnonWriteEvento, isResAppAnonWriteCli, renderAppAnonWriteLines } from "./anon-write-cmd.js";
|
|
21
22
|
export { appAutoEnhanceEvento, isResAppAutoEnhanceCli, renderAppAutoEnhanceLines, } from "./auto-enhance-cmd.js";
|
|
22
23
|
export { appCallEvento, isResAppCallCli, renderAppCallLines } from "./call-cmd.js";
|
|
24
|
+
export { appToolsEvento, appCallToolEvento, isResAppToolsCli, isResAppCallToolCli, renderAppToolsLines, renderAppCallToolLines, } from "./tools-cmd.js";
|
|
23
25
|
export { appScreenshotEvento, isResAppScreenshotCli, renderAppScreenshotLines, } from "./screenshot-cmd.js";
|
|
24
26
|
export function appSubcommands(ctx) {
|
|
25
27
|
return subcommands({
|
|
26
28
|
name: "app",
|
|
27
|
-
description: "Operate a deployed vibe: scheduled-task health, recovery, its ctx.log diagnostics, its visitor-facing chips, its look, its gallery screenshot, whether signed-out visitors can write, whether Vibes DIY may improve it, and calling its own backend routes",
|
|
29
|
+
description: "Operate a deployed vibe: scheduled-task health, recovery, its ctx.log diagnostics, its visitor-facing chips, its look, its gallery screenshot, whether signed-out visitors can write, whether Vibes DIY may improve it, and calling its own backend routes and tools",
|
|
28
30
|
cmds: {
|
|
29
31
|
status: appStatusCmd(ctx),
|
|
30
32
|
rearm: appRearmCmd(ctx),
|
|
@@ -37,6 +39,7 @@ export function appSubcommands(ctx) {
|
|
|
37
39
|
"anon-write": appAnonWriteCmd(ctx),
|
|
38
40
|
"auto-enhance": appAutoEnhanceCmd(ctx),
|
|
39
41
|
call: appCallCmd(ctx),
|
|
42
|
+
tools: appToolsCmd(ctx),
|
|
40
43
|
},
|
|
41
44
|
});
|
|
42
45
|
}
|
|
@@ -17,6 +17,8 @@ export declare const ResAppRearmCli: import("arktype/internal/variants/object.ts
|
|
|
17
17
|
intervalMs: number | null;
|
|
18
18
|
nextAlarmAt: string | null;
|
|
19
19
|
pausedIntervalMs: number | null;
|
|
20
|
+
laterTimers: number | null;
|
|
21
|
+
timersPaused: boolean | null;
|
|
20
22
|
settingsUrl: string;
|
|
21
23
|
}, {}>;
|
|
22
24
|
export type ResAppRearmCli = typeof ResAppRearmCli.infer;
|
|
@@ -9,7 +9,7 @@ import { formatErr } from "../format-err.js";
|
|
|
9
9
|
import { HANDLE_REQUIRED_CLI_MESSAGE } from "../../handle-required.js";
|
|
10
10
|
import { humanizeDuration } from "@vibes.diy/api-types";
|
|
11
11
|
import { HANDLE_FLAG_HELP, VIBE_FLAG_HELP, VIBE_POSITIONAL_HELP } from "../../vibe-arg-help.js";
|
|
12
|
-
import { appSettingsUrl, pausedScheduleLines } from "./status-cmd.js";
|
|
12
|
+
import { appSettingsUrl, laterTimerLines, pausedScheduleLines } from "./status-cmd.js";
|
|
13
13
|
export const ReqAppRearm = type({
|
|
14
14
|
type: "'vibes-diy.cli.app-rearm'",
|
|
15
15
|
appSlug: "string",
|
|
@@ -27,6 +27,8 @@ export const ResAppRearmCli = type({
|
|
|
27
27
|
intervalMs: "number|null",
|
|
28
28
|
nextAlarmAt: "string|null",
|
|
29
29
|
pausedIntervalMs: "number|null",
|
|
30
|
+
laterTimers: "number|null",
|
|
31
|
+
timersPaused: "boolean|null",
|
|
30
32
|
settingsUrl: "string",
|
|
31
33
|
});
|
|
32
34
|
export function isResAppRearmCli(obj) {
|
|
@@ -34,6 +36,9 @@ export function isResAppRearmCli(obj) {
|
|
|
34
36
|
}
|
|
35
37
|
export function renderAppRearmLines(msg) {
|
|
36
38
|
const app = `${msg.ownerHandle}/${msg.appSlug}`;
|
|
39
|
+
return [...renderTickRearmLines(msg, app), ...laterTimerLines(app, msg.laterTimers, msg.timersPaused)];
|
|
40
|
+
}
|
|
41
|
+
function renderTickRearmLines(msg, app) {
|
|
37
42
|
if (msg.state === "unscheduled" && msg.pausedIntervalMs !== null) {
|
|
38
43
|
return pausedScheduleLines(app, msg.pausedIntervalMs, msg.settingsUrl);
|
|
39
44
|
}
|
|
@@ -80,6 +85,8 @@ export const appRearmEvento = {
|
|
|
80
85
|
intervalMs: r.intervalMs,
|
|
81
86
|
nextAlarmAt: r.nextAlarmAt,
|
|
82
87
|
pausedIntervalMs: r.pausedIntervalMs ?? null,
|
|
88
|
+
laterTimers: r.laterTimers ?? null,
|
|
89
|
+
timersPaused: r.timersPaused ?? null,
|
|
83
90
|
settingsUrl: appSettingsUrl(args.apiUrl, r.ownerHandle, r.appSlug),
|
|
84
91
|
});
|
|
85
92
|
},
|
|
@@ -87,7 +94,7 @@ export const appRearmEvento = {
|
|
|
87
94
|
export function appRearmCmd(ctx) {
|
|
88
95
|
return command({
|
|
89
96
|
name: "rearm",
|
|
90
|
-
description: "Re-arm a vibe's scheduled task from its live release (a no-op when
|
|
97
|
+
description: "Re-arm a vibe's scheduled task from its live release, and resume any ctx.later timers `app schedule off` paused (a no-op when both are already running).",
|
|
91
98
|
args: {
|
|
92
99
|
...cmdTsDefaultArgs(ctx),
|
|
93
100
|
appSlug: positional({
|
|
@@ -15,6 +15,8 @@ export declare const ResAppScheduleOffCli: import("arktype/internal/variants/obj
|
|
|
15
15
|
ownerHandle: string;
|
|
16
16
|
state: "dead" | "healthy" | "overdue" | "running" | "unscheduled";
|
|
17
17
|
intervalMs: number | null;
|
|
18
|
+
laterTimers: number | null;
|
|
19
|
+
timersPaused: boolean | null;
|
|
18
20
|
}, {}>;
|
|
19
21
|
export type ResAppScheduleOffCli = typeof ResAppScheduleOffCli.infer;
|
|
20
22
|
export declare function isResAppScheduleOffCli(obj: unknown): obj is ResAppScheduleOffCli;
|
|
@@ -8,6 +8,7 @@ import { resolveVibePositionals } from "../../parse-vibe.js";
|
|
|
8
8
|
import { formatErr } from "../format-err.js";
|
|
9
9
|
import { HANDLE_REQUIRED_CLI_MESSAGE } from "../../handle-required.js";
|
|
10
10
|
import { humanizeDuration } from "@vibes.diy/api-types";
|
|
11
|
+
import { laterTimersPhrase } from "./status-cmd.js";
|
|
11
12
|
import { HANDLE_FLAG_HELP, VIBE_FLAG_HELP, VIBE_POSITIONAL_HELP } from "../../vibe-arg-help.js";
|
|
12
13
|
export const ReqAppScheduleOff = type({
|
|
13
14
|
type: "'vibes-diy.cli.app-schedule-off'",
|
|
@@ -24,18 +25,32 @@ export const ResAppScheduleOffCli = type({
|
|
|
24
25
|
ownerHandle: "string",
|
|
25
26
|
state: "'unscheduled'|'running'|'healthy'|'overdue'|'dead'",
|
|
26
27
|
intervalMs: "number|null",
|
|
28
|
+
laterTimers: "number|null",
|
|
29
|
+
timersPaused: "boolean|null",
|
|
27
30
|
});
|
|
28
31
|
export function isResAppScheduleOffCli(obj) {
|
|
29
32
|
return ResAppScheduleOffCli.allows(obj);
|
|
30
33
|
}
|
|
31
34
|
export function renderAppScheduleOffLines(msg) {
|
|
32
35
|
const app = `${msg.ownerHandle}/${msg.appSlug}`;
|
|
36
|
+
const timers = msg.laterTimers ?? 0;
|
|
37
|
+
const timersHeld = timers > 0 && msg.timersPaused === true;
|
|
38
|
+
const resume = `a deploy, or \`vibes-diy app rearm ${app}\`,`;
|
|
33
39
|
if (msg.intervalMs === null) {
|
|
34
|
-
|
|
40
|
+
if (timersHeld) {
|
|
41
|
+
return [
|
|
42
|
+
`${app}: paused ${laterTimersPhrase(timers)} — ${timers === 1 ? "it keeps its" : "they keep their"} place and wait${timers === 1 ? "s" : ""}.`,
|
|
43
|
+
` the live release is unchanged — ${resume} resumes ${timers === 1 ? "it" : "them"}.`,
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
if (msg.laterTimers === null)
|
|
47
|
+
return [`${app}: nothing to stop — no scheduled task was armed.`];
|
|
48
|
+
return [`${app}: nothing to stop — no scheduled task was armed and no \`ctx.later\` timer is waiting.`];
|
|
35
49
|
}
|
|
36
50
|
return [
|
|
37
51
|
`${app}: scheduled task stopped (was every ${humanizeDuration(msg.intervalMs)}).`,
|
|
38
|
-
`
|
|
52
|
+
...(timersHeld ? [` ${laterTimersPhrase(timers)} paused too.`] : []),
|
|
53
|
+
` the live release is unchanged — ${resume} starts it again.`,
|
|
39
54
|
];
|
|
40
55
|
}
|
|
41
56
|
export const appScheduleOffEvento = {
|
|
@@ -71,13 +86,15 @@ export const appScheduleOffEvento = {
|
|
|
71
86
|
ownerHandle: r.ownerHandle,
|
|
72
87
|
state: r.state,
|
|
73
88
|
intervalMs: r.intervalMs,
|
|
89
|
+
laterTimers: r.laterTimers ?? null,
|
|
90
|
+
timersPaused: r.timersPaused ?? null,
|
|
74
91
|
});
|
|
75
92
|
},
|
|
76
93
|
};
|
|
77
94
|
function appScheduleOffCmd(ctx) {
|
|
78
95
|
return command({
|
|
79
96
|
name: "off",
|
|
80
|
-
description: "Stop a vibe's scheduled task now (a pause — the live release is untouched, so a deploy
|
|
97
|
+
description: "Stop a vibe's scheduled task and pause its ctx.later timers now (a pause — the live release is untouched, so a deploy or `app rearm` starts both again).",
|
|
81
98
|
args: {
|
|
82
99
|
...cmdTsDefaultArgs(ctx),
|
|
83
100
|
appSlug: positional({
|
|
@@ -114,7 +131,7 @@ function appScheduleOffCmd(ctx) {
|
|
|
114
131
|
export function appScheduleCmd(ctx) {
|
|
115
132
|
return subcommands({
|
|
116
133
|
name: "schedule",
|
|
117
|
-
description: "Control a vibe's scheduled task (turning
|
|
134
|
+
description: "Control a vibe's scheduled task and ctx.later timers (turning them back on is `app rearm`, which reads the live release)",
|
|
118
135
|
cmds: {
|
|
119
136
|
off: appScheduleOffCmd(ctx),
|
|
120
137
|
},
|
|
@@ -29,12 +29,16 @@ export declare const ResAppStatusCli: import("arktype/internal/variants/object.t
|
|
|
29
29
|
pausedIntervalMs: number | null;
|
|
30
30
|
stoppedIntervalMs: number | null;
|
|
31
31
|
stoppedAt: string | null;
|
|
32
|
+
laterTimers: number | null;
|
|
33
|
+
timersPaused: boolean | null;
|
|
32
34
|
settingsUrl: string;
|
|
33
35
|
}, {}>;
|
|
34
36
|
export type ResAppStatusCli = typeof ResAppStatusCli.infer;
|
|
35
37
|
export declare function isResAppStatusCli(obj: unknown): obj is ResAppStatusCli;
|
|
36
38
|
export declare function appSettingsUrl(apiUrl: string, ownerHandle: string, appSlug: string): string;
|
|
37
39
|
export declare function pausedScheduleLines(app: string, pausedIntervalMs: number, settingsUrl: string): string[];
|
|
40
|
+
export declare function laterTimersPhrase(n: number): string;
|
|
41
|
+
export declare function laterTimerLines(app: string, laterTimers: number | null, timersPaused: boolean | null): string[];
|
|
38
42
|
export declare function renderAppStatusLines(msg: ResAppStatusCli): string[];
|
|
39
43
|
export declare const appStatusEvento: EventoHandler<WrapCmdTSMsg<unknown>, ReqAppStatus, ResAppStatusCli>;
|
|
40
44
|
export declare function appStatusCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
@@ -39,6 +39,8 @@ export const ResAppStatusCli = type({
|
|
|
39
39
|
pausedIntervalMs: "number|null",
|
|
40
40
|
stoppedIntervalMs: "number|null",
|
|
41
41
|
stoppedAt: "string|null",
|
|
42
|
+
laterTimers: "number|null",
|
|
43
|
+
timersPaused: "boolean|null",
|
|
42
44
|
settingsUrl: "string",
|
|
43
45
|
});
|
|
44
46
|
export function isResAppStatusCli(obj) {
|
|
@@ -53,8 +55,28 @@ export function pausedScheduleLines(app, pausedIntervalMs, settingsUrl) {
|
|
|
53
55
|
` Start it again: turn on "Scheduled runs" in App settings: ${settingsUrl}`,
|
|
54
56
|
];
|
|
55
57
|
}
|
|
58
|
+
export function laterTimersPhrase(n) {
|
|
59
|
+
return `${n} \`ctx.later\` timer${n === 1 ? "" : "s"}`;
|
|
60
|
+
}
|
|
61
|
+
export function laterTimerLines(app, laterTimers, timersPaused) {
|
|
62
|
+
if (laterTimers === null || laterTimers === 0)
|
|
63
|
+
return [];
|
|
64
|
+
if (timersPaused === true) {
|
|
65
|
+
return [
|
|
66
|
+
` ${laterTimersPhrase(laterTimers)} paused — \`npx vibes-diy app rearm ${app}\` (or your next deploy) resumes ${laterTimers === 1 ? "it" : "them"}.`,
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
return [` ${laterTimersPhrase(laterTimers)} set — each one runs when it is due.`];
|
|
70
|
+
}
|
|
56
71
|
export function renderAppStatusLines(msg) {
|
|
57
72
|
const app = `${msg.ownerHandle}/${msg.appSlug}`;
|
|
73
|
+
const tick = renderTickStatusLines(msg, app);
|
|
74
|
+
if (msg.state === "unscheduled" && msg.pausedIntervalMs !== null && msg.laterTimers !== null && msg.laterTimers > 0) {
|
|
75
|
+
return [...tick, ` ${laterTimersPhrase(msg.laterTimers)} wait for "Scheduled runs" to be on again.`];
|
|
76
|
+
}
|
|
77
|
+
return [...tick, ...laterTimerLines(app, msg.laterTimers, msg.timersPaused)];
|
|
78
|
+
}
|
|
79
|
+
function renderTickStatusLines(msg, app) {
|
|
58
80
|
if (msg.state === "unscheduled" && msg.pausedIntervalMs !== null) {
|
|
59
81
|
return pausedScheduleLines(app, msg.pausedIntervalMs, msg.settingsUrl);
|
|
60
82
|
}
|
|
@@ -151,6 +173,8 @@ export const appStatusEvento = {
|
|
|
151
173
|
pausedIntervalMs: s.pausedIntervalMs ?? null,
|
|
152
174
|
stoppedIntervalMs: s.stoppedIntervalMs ?? null,
|
|
153
175
|
stoppedAt: s.stoppedAt ?? null,
|
|
176
|
+
laterTimers: s.laterTimers ?? null,
|
|
177
|
+
timersPaused: s.timersPaused ?? null,
|
|
154
178
|
settingsUrl: appSettingsUrl(args.apiUrl, s.ownerHandle, s.appSlug),
|
|
155
179
|
});
|
|
156
180
|
},
|
|
@@ -158,7 +182,7 @@ export const appStatusEvento = {
|
|
|
158
182
|
export function appStatusCmd(ctx) {
|
|
159
183
|
return command({
|
|
160
184
|
name: "status",
|
|
161
|
-
description: "Show a vibe's scheduled-task health: last tick, next tick, failures. Re-arms a dead timer if it finds one.",
|
|
185
|
+
description: "Show a vibe's scheduled-task health: last tick, next tick, failures, and any ctx.later timers waiting. Re-arms a dead timer if it finds one.",
|
|
162
186
|
args: {
|
|
163
187
|
...cmdTsDefaultArgs(ctx),
|
|
164
188
|
appSlug: positional({
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Result, EventoHandler } from "@adviser/cement";
|
|
2
|
+
import { type ResCallVibeTool, type ResListVibeTools } from "@vibes.diy/api-types";
|
|
3
|
+
import { CliCtx } from "../../cli-ctx.js";
|
|
4
|
+
import { WrapCmdTSMsg } from "../../cmd-evento.js";
|
|
5
|
+
export declare const APP_TOOL_NAME_PATTERN: RegExp;
|
|
6
|
+
export declare function isAppToolName(word: string): boolean;
|
|
7
|
+
export declare function parseToolInput(raw: string): Result<Record<string, unknown>>;
|
|
8
|
+
export declare const ReqAppTools: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
9
|
+
type: "vibes-diy.cli.app-tools";
|
|
10
|
+
appSlug: string;
|
|
11
|
+
ownerHandle: string;
|
|
12
|
+
apiUrl: string;
|
|
13
|
+
}, {}>;
|
|
14
|
+
export type ReqAppTools = typeof ReqAppTools.infer;
|
|
15
|
+
export declare function isReqAppTools(obj: unknown): obj is ReqAppTools;
|
|
16
|
+
export declare const ResAppToolsCli: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
17
|
+
type: "vibes-diy.cli.res-app-tools";
|
|
18
|
+
ownerHandle: string;
|
|
19
|
+
appSlug: string;
|
|
20
|
+
tools: {
|
|
21
|
+
name: string;
|
|
22
|
+
title?: string | undefined;
|
|
23
|
+
description: string;
|
|
24
|
+
for: "anyone" | "members" | "owner";
|
|
25
|
+
runs: "handler" | "write";
|
|
26
|
+
db?: string | undefined;
|
|
27
|
+
inputSchema: Record<string, unknown>;
|
|
28
|
+
annotations?: {
|
|
29
|
+
readOnly?: true | undefined;
|
|
30
|
+
consequential?: true | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
outputSchema?: Record<string, unknown> | undefined;
|
|
33
|
+
}[];
|
|
34
|
+
note: string;
|
|
35
|
+
}, {}>;
|
|
36
|
+
export type ResAppToolsCli = typeof ResAppToolsCli.infer;
|
|
37
|
+
export declare function isResAppToolsCli(obj: unknown): obj is ResAppToolsCli;
|
|
38
|
+
export declare function renderAppToolsLines(msg: ResAppToolsCli): string[];
|
|
39
|
+
export declare const appToolsEvento: EventoHandler<WrapCmdTSMsg<unknown>, ReqAppTools, ResAppToolsCli>;
|
|
40
|
+
export declare function appToolsCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
41
|
+
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
42
|
+
apiUrl: string;
|
|
43
|
+
json: boolean;
|
|
44
|
+
text: boolean;
|
|
45
|
+
appSlug: string | undefined;
|
|
46
|
+
vibe: string;
|
|
47
|
+
handle: string;
|
|
48
|
+
}>>;
|
|
49
|
+
} & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
|
|
50
|
+
apiUrl: string;
|
|
51
|
+
json: boolean;
|
|
52
|
+
text: boolean;
|
|
53
|
+
appSlug: string | undefined;
|
|
54
|
+
vibe: string;
|
|
55
|
+
handle: string;
|
|
56
|
+
}, never> & {
|
|
57
|
+
run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<never>>;
|
|
58
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
|
|
59
|
+
export declare const ReqAppCallTool: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
60
|
+
type: "vibes-diy.cli.app-call-tool";
|
|
61
|
+
appSlug: string;
|
|
62
|
+
ownerHandle: string;
|
|
63
|
+
apiUrl: string;
|
|
64
|
+
tool: string;
|
|
65
|
+
input: string;
|
|
66
|
+
}, {}>;
|
|
67
|
+
export type ReqAppCallTool = typeof ReqAppCallTool.infer;
|
|
68
|
+
export declare function isReqAppCallTool(obj: unknown): obj is ReqAppCallTool;
|
|
69
|
+
export declare const appToolCallOutcome: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
70
|
+
reason: "ok";
|
|
71
|
+
result: unknown;
|
|
72
|
+
truncated?: true | undefined;
|
|
73
|
+
} | {
|
|
74
|
+
reason: "refused";
|
|
75
|
+
message: string;
|
|
76
|
+
needsConfirm?: true | undefined;
|
|
77
|
+
} | {
|
|
78
|
+
reason: "invalid_input" | "tool_error";
|
|
79
|
+
message: string;
|
|
80
|
+
} | {
|
|
81
|
+
reason: "handler_threw";
|
|
82
|
+
errorName: string;
|
|
83
|
+
} | {
|
|
84
|
+
reason: "no_tool" | "unavailable" | "unknown_outcome";
|
|
85
|
+
} | {
|
|
86
|
+
reason: "cancelled" | "needs-confirm";
|
|
87
|
+
}, {}>;
|
|
88
|
+
export type AppToolCallOutcome = typeof appToolCallOutcome.infer;
|
|
89
|
+
export declare const ResAppCallToolCli: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
90
|
+
type: "vibes-diy.cli.res-app-call-tool";
|
|
91
|
+
ownerHandle: string;
|
|
92
|
+
appSlug: string;
|
|
93
|
+
tool: string;
|
|
94
|
+
outcome: {
|
|
95
|
+
reason: "ok";
|
|
96
|
+
result: unknown;
|
|
97
|
+
truncated?: true | undefined;
|
|
98
|
+
} | {
|
|
99
|
+
reason: "refused";
|
|
100
|
+
message: string;
|
|
101
|
+
needsConfirm?: true | undefined;
|
|
102
|
+
} | {
|
|
103
|
+
reason: "invalid_input" | "tool_error";
|
|
104
|
+
message: string;
|
|
105
|
+
} | {
|
|
106
|
+
reason: "handler_threw";
|
|
107
|
+
errorName: string;
|
|
108
|
+
} | {
|
|
109
|
+
reason: "no_tool" | "unavailable" | "unknown_outcome";
|
|
110
|
+
} | {
|
|
111
|
+
reason: "cancelled" | "needs-confirm";
|
|
112
|
+
};
|
|
113
|
+
note: string;
|
|
114
|
+
}, {}>;
|
|
115
|
+
export type ResAppCallToolCli = typeof ResAppCallToolCli.infer;
|
|
116
|
+
export declare function isResAppCallToolCli(obj: unknown): obj is ResAppCallToolCli;
|
|
117
|
+
export type AskPerson = (question: string) => Promise<boolean | undefined>;
|
|
118
|
+
export declare const terminalAskPerson: AskPerson;
|
|
119
|
+
export interface AppToolCallApi {
|
|
120
|
+
listVibeTools(req: {
|
|
121
|
+
ownerHandle: string;
|
|
122
|
+
appSlug: string;
|
|
123
|
+
}): Promise<Result<ResListVibeTools, unknown>>;
|
|
124
|
+
callVibeTool(req: {
|
|
125
|
+
ownerHandle: string;
|
|
126
|
+
appSlug: string;
|
|
127
|
+
tool: string;
|
|
128
|
+
input: unknown;
|
|
129
|
+
personYes?: "terminal";
|
|
130
|
+
}): Promise<Result<ResCallVibeTool, unknown>>;
|
|
131
|
+
}
|
|
132
|
+
export declare function runAppToolCall(args: {
|
|
133
|
+
readonly api: AppToolCallApi;
|
|
134
|
+
readonly ownerHandle: string;
|
|
135
|
+
readonly appSlug: string;
|
|
136
|
+
readonly tool: string;
|
|
137
|
+
readonly input: Record<string, unknown>;
|
|
138
|
+
readonly askPerson: AskPerson;
|
|
139
|
+
}): Promise<Result<ResAppCallToolCli>>;
|
|
140
|
+
export declare function renderAppCallToolLines(msg: ResAppCallToolCli): string[];
|
|
141
|
+
export declare const appCallToolEvento: EventoHandler<WrapCmdTSMsg<unknown>, ReqAppCallTool, ResAppCallToolCli>;
|