@vibesdotdev/surface-cli 0.0.0-stage → 1.0.0-rc.1
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 +18 -0
- package/README.md +62 -2
- package/dist/bun/external-hook-relay.d.ts +26 -0
- package/dist/bun/external-hook-relay.d.ts.map +1 -0
- package/dist/bun/external-hook-relay.js +202 -0
- package/dist/bun/external-hook-relay.js.map +1 -0
- package/dist/bun/host-argv.d.ts +63 -0
- package/dist/bun/host-argv.d.ts.map +1 -0
- package/dist/bun/host-argv.js +129 -0
- package/dist/bun/host-argv.js.map +1 -0
- package/dist/bun/host.d.ts +10 -0
- package/dist/bun/host.d.ts.map +1 -0
- package/dist/bun/host.js +116 -0
- package/dist/bun/host.js.map +1 -0
- package/dist/cli-bootstrap.d.ts +38 -0
- package/dist/cli-bootstrap.d.ts.map +1 -0
- package/dist/cli-bootstrap.js +163 -0
- package/dist/cli-bootstrap.js.map +1 -0
- package/dist/execution/index.d.ts +53 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +58 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/execution/toolchains/pinned-toolchain.d.ts +20 -0
- package/dist/execution/toolchains/pinned-toolchain.d.ts.map +1 -0
- package/dist/execution/toolchains/pinned-toolchain.js +23 -0
- package/dist/execution/toolchains/pinned-toolchain.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/relay.config.descriptor.d.ts +38 -0
- package/dist/relay.config.descriptor.d.ts.map +1 -0
- package/dist/relay.config.descriptor.js +25 -0
- package/dist/relay.config.descriptor.js.map +1 -0
- package/dist/schemas/hook-relay.d.ts +129 -0
- package/dist/schemas/hook-relay.d.ts.map +1 -0
- package/dist/schemas/hook-relay.js +71 -0
- package/dist/schemas/hook-relay.js.map +1 -0
- package/dist/schemas/host.d.ts +36 -0
- package/dist/schemas/host.d.ts.map +1 -0
- package/dist/schemas/host.js +2 -0
- package/dist/schemas/host.js.map +1 -0
- package/dist/session-lifecycle.d.ts +22 -0
- package/dist/session-lifecycle.d.ts.map +1 -0
- package/dist/session-lifecycle.js +83 -0
- package/dist/session-lifecycle.js.map +1 -0
- package/dist/workspace-effect-preparer.d.ts +14 -0
- package/dist/workspace-effect-preparer.d.ts.map +1 -0
- package/dist/workspace-effect-preparer.js +74 -0
- package/dist/workspace-effect-preparer.js.map +1 -0
- package/package.json +113 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay.config.descriptor.js","sourceRoot":"","sources":["../src/relay.config.descriptor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE9E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,qBAAqB;IAC3B,SAAS,EAAE,wBAAwB;IACnC,MAAM,EAAE,iBAAiB;IACzB,WAAW,EAAE,MAAM;IACnB,eAAe,EAAE,CAAC,gBAAgB,CAAC;IACnC,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE;QACP,SAAS,EAAE;YACV,EAAE,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE;YAC7B,QAAQ,EAAE;gBACT,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS;gBAC3C,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC,CAAC,IAAI,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS;aACrJ;SACD;KACD;CACkC,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Surface-owned projection of external's hook-call wire input. The owner does
|
|
4
|
+
* not export HookCallActionInputSchema on a supported package entrypoint.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ExternalHookRelayArgvSchema: z.ZodObject<{
|
|
7
|
+
event: z.ZodString;
|
|
8
|
+
target: z.ZodString;
|
|
9
|
+
output: z.ZodEnum<{
|
|
10
|
+
native: "native";
|
|
11
|
+
json: "json";
|
|
12
|
+
text: "text";
|
|
13
|
+
}>;
|
|
14
|
+
disableBrain: z.ZodBoolean;
|
|
15
|
+
disablePrompts: z.ZodBoolean;
|
|
16
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type ExternalHookRelayArgv = z.infer<typeof ExternalHookRelayArgvSchema>;
|
|
19
|
+
export declare const HookCallRecordSchema: z.ZodPipe<z.ZodObject<{
|
|
20
|
+
event: z.ZodString;
|
|
21
|
+
target: z.ZodString;
|
|
22
|
+
output: z.ZodEnum<{
|
|
23
|
+
native: "native";
|
|
24
|
+
json: "json";
|
|
25
|
+
text: "text";
|
|
26
|
+
}>;
|
|
27
|
+
disableBrain: z.ZodBoolean;
|
|
28
|
+
disablePrompts: z.ZodBoolean;
|
|
29
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
30
|
+
action: z.ZodLiteral<"hook-call">;
|
|
31
|
+
stdin: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>, z.ZodTransform<import("@vibesdotdev/kernel/schemas/json").JsonObject, {
|
|
33
|
+
event: string;
|
|
34
|
+
target: string;
|
|
35
|
+
output: "native" | "json" | "text";
|
|
36
|
+
disableBrain: boolean;
|
|
37
|
+
disablePrompts: boolean;
|
|
38
|
+
action: "hook-call";
|
|
39
|
+
prompt?: string | undefined;
|
|
40
|
+
stdin?: string | undefined;
|
|
41
|
+
}>>;
|
|
42
|
+
/**
|
|
43
|
+
* The adapter's typed refusal of the hook payload: the harness still receives
|
|
44
|
+
* the adapter's native rendering on stdout, and the relay keeps this diagnostic.
|
|
45
|
+
*/
|
|
46
|
+
export declare const HookRejectionSchema: z.ZodObject<{
|
|
47
|
+
code: z.ZodString;
|
|
48
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
49
|
+
message: z.ZodString;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type HookRejection = z.infer<typeof HookRejectionSchema>;
|
|
52
|
+
/**
|
|
53
|
+
* Empty stdout is a valid answer; missing or non-text stdout is not. A failed
|
|
54
|
+
* call keeps the owner's recovery hint, which the daemon's envelope carries.
|
|
55
|
+
*/
|
|
56
|
+
export declare const HookReceiptSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
57
|
+
success: z.ZodLiteral<true>;
|
|
58
|
+
result: z.ZodObject<{
|
|
59
|
+
data: z.ZodObject<{
|
|
60
|
+
stdout: z.ZodString;
|
|
61
|
+
rejection: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
62
|
+
code: z.ZodString;
|
|
63
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
64
|
+
message: z.ZodString;
|
|
65
|
+
}, z.core.$strip>>>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
success: z.ZodLiteral<false>;
|
|
70
|
+
error: z.ZodOptional<z.ZodString>;
|
|
71
|
+
recoveryHint: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
72
|
+
}, z.core.$strip>], "success">;
|
|
73
|
+
export declare const RelayConfigSchema: z.ZodObject<{
|
|
74
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export declare const TimeoutEnvSchema: z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number, number>>;
|
|
77
|
+
export declare const FailureFactsSchema: z.ZodObject<{
|
|
78
|
+
name: z.ZodCatch<z.ZodString>;
|
|
79
|
+
message: z.ZodCatch<z.ZodString>;
|
|
80
|
+
reason: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
81
|
+
recoveryHint: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
export declare const FailureCodeSchema: z.ZodObject<{
|
|
84
|
+
code: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
85
|
+
reason: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
export declare const WaitTimeoutSchema: z.ZodObject<{
|
|
88
|
+
reason: z.ZodLiteral<"wait-timeout">;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
declare const RuntimeDaemonInvokerSchema: z.ZodCustom<Pick<import("@vibesdotdev/kernel-rpc/client").RpcUnixClient, "invokeTool">, Pick<import("@vibesdotdev/kernel-rpc/client").RpcUnixClient, "invokeTool">>;
|
|
91
|
+
export type RuntimeDaemonInvoker = z.infer<typeof RuntimeDaemonInvokerSchema>;
|
|
92
|
+
export declare const RelayTargetSchema: z.ZodObject<{
|
|
93
|
+
client: z.ZodCustom<Pick<import("@vibesdotdev/kernel-rpc/client").RpcUnixClient, "invokeTool">, Pick<import("@vibesdotdev/kernel-rpc/client").RpcUnixClient, "invokeTool">>;
|
|
94
|
+
workspaceRoot: z.ZodString;
|
|
95
|
+
lifecycle: z.ZodCustom<Pick<import("@vibesdotdev/kernel").RuntimeLifecycle, "wait">, Pick<import("@vibesdotdev/kernel").RuntimeLifecycle, "wait">>;
|
|
96
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
dispose: z.ZodOptional<z.ZodCustom<() => Promise<void>, () => Promise<void>>>;
|
|
98
|
+
run: z.ZodOptional<z.ZodCustom<(<T>(call: () => Promise<T>) => Promise<T>), <T>(call: () => Promise<T>) => Promise<T>>>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
export type RelayTarget = z.infer<typeof RelayTargetSchema>;
|
|
101
|
+
export declare const ExternalHookRelayOptionsSchema: z.ZodObject<{
|
|
102
|
+
request: z.ZodObject<{
|
|
103
|
+
event: z.ZodString;
|
|
104
|
+
target: z.ZodString;
|
|
105
|
+
output: z.ZodEnum<{
|
|
106
|
+
native: "native";
|
|
107
|
+
json: "json";
|
|
108
|
+
text: "text";
|
|
109
|
+
}>;
|
|
110
|
+
disableBrain: z.ZodBoolean;
|
|
111
|
+
disablePrompts: z.ZodBoolean;
|
|
112
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
stdin: z.ZodOptional<z.ZodString>;
|
|
115
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
117
|
+
client: z.ZodCustom<Pick<import("@vibesdotdev/kernel-rpc/client").RpcUnixClient, "invokeTool">, Pick<import("@vibesdotdev/kernel-rpc/client").RpcUnixClient, "invokeTool">>;
|
|
118
|
+
workspaceRoot: z.ZodString;
|
|
119
|
+
lifecycle: z.ZodCustom<Pick<import("@vibesdotdev/kernel").RuntimeLifecycle, "wait">, Pick<import("@vibesdotdev/kernel").RuntimeLifecycle, "wait">>;
|
|
120
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
dispose: z.ZodOptional<z.ZodCustom<() => Promise<void>, () => Promise<void>>>;
|
|
122
|
+
run: z.ZodOptional<z.ZodCustom<(<T>(call: () => Promise<T>) => Promise<T>), <T>(call: () => Promise<T>) => Promise<T>>>;
|
|
123
|
+
}, z.core.$strip>>;
|
|
124
|
+
stdout: z.ZodCustom<(text: string) => void, (text: string) => void>;
|
|
125
|
+
stderr: z.ZodCustom<(text: string) => void, (text: string) => void>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type ExternalHookRelayOptions = z.infer<typeof ExternalHookRelayOptionsSchema>;
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=hook-relay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-relay.d.ts","sourceRoot":"","sources":["../../src/schemas/hook-relay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAK5B;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;iBAOtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;GAK9B,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;8BAM5B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AACH,eAAO,MAAM,gBAAgB,wEAAiF,CAAC;AAE/G,eAAO,MAAM,kBAAkB;;;;;iBAK7B,CAAC;AACH,eAAO,MAAM,iBAAiB;;;iBAG5B,CAAC;AACH,eAAO,MAAM,iBAAiB;;iBAAkD,CAAC;AAEjF,QAAA,MAAM,0BAA0B,qKAAyE,CAAC;AAC1G,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,eAAO,MAAM,iBAAiB;;;;;6CAKL,OAAO,CAAC,IAAI,CAAC,QAAb,OAAO,CAAC,IAAI,CAAC;qCACtB,CAAC,QAAQ,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAxC,CAAC,QAAQ,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;iBACtD,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;iDALlB,OAAO,CAAC,IAAI,CAAC,QAAb,OAAO,CAAC,IAAI,CAAC;yCACtB,CAAC,QAAQ,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,IAAxC,CAAC,QAAQ,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;;+BAS/B,MAAM,KAAK,IAAI,SAAf,MAAM,KAAK,IAAI;+BACf,MAAM,KAAK,IAAI,SAAf,MAAM,KAAK,IAAI;iBACtC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { JsonObjectSchema } from '@vibesdotdev/kernel/schemas/json';
|
|
3
|
+
/**
|
|
4
|
+
* Surface-owned projection of external's hook-call wire input. The owner does
|
|
5
|
+
* not export HookCallActionInputSchema on a supported package entrypoint.
|
|
6
|
+
*/
|
|
7
|
+
export const ExternalHookRelayArgvSchema = z.object({
|
|
8
|
+
event: z.string().min(1),
|
|
9
|
+
target: z.string().min(1),
|
|
10
|
+
output: z.enum(['text', 'json', 'native']),
|
|
11
|
+
disableBrain: z.boolean(),
|
|
12
|
+
disablePrompts: z.boolean(),
|
|
13
|
+
prompt: z.string().optional()
|
|
14
|
+
});
|
|
15
|
+
export const HookCallRecordSchema = ExternalHookRelayArgvSchema.extend({
|
|
16
|
+
action: z.literal('hook-call'),
|
|
17
|
+
stdin: z.string().optional()
|
|
18
|
+
}).transform(value => JsonObjectSchema.parse(Object.fromEntries(Object.entries(value).filter(([, field]) => field !== undefined))));
|
|
19
|
+
/**
|
|
20
|
+
* The adapter's typed refusal of the hook payload: the harness still receives
|
|
21
|
+
* the adapter's native rendering on stdout, and the relay keeps this diagnostic.
|
|
22
|
+
*/
|
|
23
|
+
export const HookRejectionSchema = z.object({
|
|
24
|
+
code: z.string(),
|
|
25
|
+
reason: z.string().optional(),
|
|
26
|
+
message: z.string()
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Empty stdout is a valid answer; missing or non-text stdout is not. A failed
|
|
30
|
+
* call keeps the owner's recovery hint, which the daemon's envelope carries.
|
|
31
|
+
*/
|
|
32
|
+
export const HookReceiptSchema = z.discriminatedUnion('success', [
|
|
33
|
+
z.object({
|
|
34
|
+
success: z.literal(true),
|
|
35
|
+
result: z.object({ data: z.object({ stdout: z.string(), rejection: HookRejectionSchema.optional().catch(undefined) }) })
|
|
36
|
+
}),
|
|
37
|
+
z.object({ success: z.literal(false), error: z.string().optional(), recoveryHint: z.string().optional().catch(undefined) })
|
|
38
|
+
]);
|
|
39
|
+
export const RelayConfigSchema = z.object({
|
|
40
|
+
timeoutMs: z.number().int().positive().max(60_000).default(35_000)
|
|
41
|
+
});
|
|
42
|
+
export const TimeoutEnvSchema = z.coerce.number().int().positive().transform(value => Math.min(value, 60_000));
|
|
43
|
+
export const FailureFactsSchema = z.object({
|
|
44
|
+
name: z.string().catch('Error'),
|
|
45
|
+
message: z.string().catch(''),
|
|
46
|
+
reason: z.string().optional().catch(undefined),
|
|
47
|
+
recoveryHint: z.string().optional().catch(undefined)
|
|
48
|
+
});
|
|
49
|
+
export const FailureCodeSchema = z.object({
|
|
50
|
+
code: z.string().optional().catch(undefined),
|
|
51
|
+
reason: z.string().optional().catch(undefined)
|
|
52
|
+
});
|
|
53
|
+
export const WaitTimeoutSchema = z.object({ reason: z.literal('wait-timeout') });
|
|
54
|
+
const RuntimeDaemonInvokerSchema = z.custom();
|
|
55
|
+
export const RelayTargetSchema = z.object({
|
|
56
|
+
client: RuntimeDaemonInvokerSchema,
|
|
57
|
+
workspaceRoot: z.string(),
|
|
58
|
+
lifecycle: z.custom(),
|
|
59
|
+
timeoutMs: z.number().optional(),
|
|
60
|
+
dispose: z.custom().optional(),
|
|
61
|
+
run: z.custom().optional()
|
|
62
|
+
});
|
|
63
|
+
export const ExternalHookRelayOptionsSchema = z.object({
|
|
64
|
+
request: ExternalHookRelayArgvSchema,
|
|
65
|
+
stdin: z.string().optional(),
|
|
66
|
+
timeoutMs: z.number().optional(),
|
|
67
|
+
target: RelayTargetSchema.optional(),
|
|
68
|
+
stdout: z.custom(),
|
|
69
|
+
stderr: z.custom()
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=hook-relay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-relay.js","sourceRoot":"","sources":["../../src/schemas/hook-relay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIpE;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1C,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,MAAM,CAAC;IACtE,MAAM,EAAE,CAAC,CAAC,OAAO,CAA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,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;AAEjF,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,EAA8D,CAAC;AAE1G,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,0BAA0B;IAClC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAyC;IAC5D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAuB,CAAC,QAAQ,EAAE;IACnD,GAAG,EAAE,CAAC,CAAC,MAAM,EAA6C,CAAC,QAAQ,EAAE;CACrE,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,OAAO,EAAE,2BAA2B;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAA0B;IAC1C,MAAM,EAAE,CAAC,CAAC,MAAM,EAA0B;CAC1C,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI host entry's declared inputs: what an executable hands `runCliHost`.
|
|
3
|
+
*/
|
|
4
|
+
import type { HostBootstrap } from '@vibesdotdev/cli/host-bootstrap';
|
|
5
|
+
import type { RelayTarget } from './hook-relay.ts';
|
|
6
|
+
import type { CliPluginLoader, VibesCliAppOptions } from '../cli-bootstrap.ts';
|
|
7
|
+
/** What a CLI executable's host entry hands `runCliHost`. */
|
|
8
|
+
export interface RunCliHostOptions {
|
|
9
|
+
/** Arguments supplied by an executable which consumed its own launch metadata. */
|
|
10
|
+
readonly argv?: readonly string[];
|
|
11
|
+
/** Attest the declared host graph before reading workspace composition. */
|
|
12
|
+
readonly attestHostGraph?: boolean;
|
|
13
|
+
/** The executable's explicit module-graph root and re-entry facts, when it owns them. */
|
|
14
|
+
readonly host?: VibesCliAppOptions['host'];
|
|
15
|
+
/** Whether this executable includes the user's global plugin selections. */
|
|
16
|
+
readonly globalPackagePlugins?: boolean;
|
|
17
|
+
/** Caller-declared environment, using the app's existing composition seam. */
|
|
18
|
+
readonly environment?: VibesCliAppOptions['environment'];
|
|
19
|
+
/** An admitted relay transport, using the relay's existing target seam. */
|
|
20
|
+
readonly hookRelayTarget?: RelayTarget;
|
|
21
|
+
/**
|
|
22
|
+
* The executable's plugin floor: loaders (the host's own capabilities) and
|
|
23
|
+
* specifiers resolved at the host root, composed first and never shadowed
|
|
24
|
+
* away by a scope list.
|
|
25
|
+
*/
|
|
26
|
+
readonly hostPlugins: ReadonlyArray<CliPluginLoader | string>;
|
|
27
|
+
/** The executable's declared config block, by config manifest id (the composition floor's config). */
|
|
28
|
+
readonly hostConfig?: VibesCliAppOptions['hostConfig'];
|
|
29
|
+
/**
|
|
30
|
+
* First-install inputs (the shim's device session), validated here before
|
|
31
|
+
* anything boots (`InvalidHostBootstrapError` when malformed). The caller
|
|
32
|
+
* composes its runtime-local context into `hostPlugins`.
|
|
33
|
+
*/
|
|
34
|
+
readonly bootstrap?: HostBootstrap;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/schemas/host.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IACjC,kFAAkF;IAClF,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,yFAAyF;IACzF,QAAQ,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACzD,2EAA2E;IAC3E,QAAQ,CAAC,eAAe,CAAC,EAAE,WAAW,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,eAAe,GAAG,MAAM,CAAC,CAAC;IAC9D,sGAAsG;IACtG,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACvD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/schemas/host.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime session lifecycle observer for actual CLI actions.
|
|
3
|
+
*
|
|
4
|
+
* Lifecycle telemetry is best effort, and the CLI surface owns that policy:
|
|
5
|
+
* a capture failure here is a typed refusal (`UNAVAILABLE`
|
|
6
|
+
* `session-telemetry-failed`, the failure as its cause) thrown to the surface's
|
|
7
|
+
* invocation controller, which isolates it from the command's outcome and
|
|
8
|
+
* reports it (under `-v`) through the CLI failure renderer.
|
|
9
|
+
*/
|
|
10
|
+
import type { CLIInvocationObserver } from '@vibesdotdev/cli/schemas/surface';
|
|
11
|
+
import { type VibesRuntime } from '@vibesdotdev/kernel';
|
|
12
|
+
/** What the session observer's start answers its end: the session it bound, or null when it bound none. */
|
|
13
|
+
export type SessionInvocationToken = string | null;
|
|
14
|
+
export declare function createCliSessionInvocationObserver(params: {
|
|
15
|
+
/**
|
|
16
|
+
* The runtime the action runs on, read at action time: a serve command's
|
|
17
|
+
* transition replaces the CLI runtime before the action starts.
|
|
18
|
+
*/
|
|
19
|
+
runtime: () => VibesRuntime;
|
|
20
|
+
getActiveSessionId?: () => Promise<string | null>;
|
|
21
|
+
}): CLIInvocationObserver<SessionInvocationToken>;
|
|
22
|
+
//# sourceMappingURL=session-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-lifecycle.d.ts","sourceRoot":"","sources":["../src/session-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEzE,2GAA2G;AAC3G,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,IAAI,CAAC;AAEnD,wBAAgB,kCAAkC,CAAC,MAAM,EAAE;IAC1D;;;OAGG;IACH,OAAO,EAAE,MAAM,YAAY,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAClD,GAAG,qBAAqB,CAAC,sBAAsB,CAAC,CAoEhD"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime session lifecycle observer for actual CLI actions.
|
|
3
|
+
*
|
|
4
|
+
* Lifecycle telemetry is best effort, and the CLI surface owns that policy:
|
|
5
|
+
* a capture failure here is a typed refusal (`UNAVAILABLE`
|
|
6
|
+
* `session-telemetry-failed`, the failure as its cause) thrown to the surface's
|
|
7
|
+
* invocation controller, which isolates it from the command's outcome and
|
|
8
|
+
* reports it (under `-v`) through the CLI failure renderer.
|
|
9
|
+
*/
|
|
10
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
11
|
+
export function createCliSessionInvocationObserver(params) {
|
|
12
|
+
const runtime = params.runtime;
|
|
13
|
+
/** The session this observer bound for the active action; the controller pairs one start with one end. */
|
|
14
|
+
let boundSessionId = null;
|
|
15
|
+
const getActiveSessionId = params.getActiveSessionId ??
|
|
16
|
+
(async () => {
|
|
17
|
+
const manager = await runtime()
|
|
18
|
+
.context('session/manager')
|
|
19
|
+
.catch((error) => {
|
|
20
|
+
// The runtime's absence error is NOT_FOUND `not-registered` for kind 'context', id 'session/manager'.
|
|
21
|
+
if (CapabilityError.isAbsenceOf(error, 'context', 'session/manager')) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
throw error;
|
|
25
|
+
});
|
|
26
|
+
const session = manager ? await manager.getActiveSession() : null;
|
|
27
|
+
return session?.id ?? null;
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
start: async (info) => {
|
|
31
|
+
boundSessionId = null;
|
|
32
|
+
// Session/awareness capture is itself a home write. A descriptor that
|
|
33
|
+
// resolves to storage-free must not be made writing by observability.
|
|
34
|
+
if (!info.effects.homeWrite)
|
|
35
|
+
return null;
|
|
36
|
+
// A shared host (MCP host, daemon) acts for no seat; the seats it serves
|
|
37
|
+
// announce their own bindings. Announcing one here bound nobody.
|
|
38
|
+
if (info.effects.sharedHost)
|
|
39
|
+
return null;
|
|
40
|
+
try {
|
|
41
|
+
const sessionId = await getActiveSessionId();
|
|
42
|
+
if (!sessionId)
|
|
43
|
+
return null;
|
|
44
|
+
const { emitSessionBound } = await import('@vibesdotdev/session/events/session.bound');
|
|
45
|
+
await emitSessionBound({ runtime: runtime(), sessionId, surface: 'cli' });
|
|
46
|
+
boundSessionId = sessionId;
|
|
47
|
+
return sessionId;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new CapabilityError('The session bound event could not be captured.', 'UNAVAILABLE', {
|
|
51
|
+
reason: 'session-telemetry-failed',
|
|
52
|
+
retryable: true,
|
|
53
|
+
details: { half: 'bound' },
|
|
54
|
+
cause: error
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
end: async () => {
|
|
59
|
+
const sessionId = boundSessionId;
|
|
60
|
+
boundSessionId = null;
|
|
61
|
+
if (sessionId === null)
|
|
62
|
+
return;
|
|
63
|
+
try {
|
|
64
|
+
const { emitSessionUnbound } = await import('@vibesdotdev/session/events/session.unbound');
|
|
65
|
+
await emitSessionUnbound({
|
|
66
|
+
runtime: runtime(),
|
|
67
|
+
sessionId,
|
|
68
|
+
surface: 'cli',
|
|
69
|
+
reason: 'cli-run-complete'
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw new CapabilityError('The session unbound event could not be captured.', 'UNAVAILABLE', {
|
|
74
|
+
reason: 'session-telemetry-failed',
|
|
75
|
+
retryable: true,
|
|
76
|
+
details: { half: 'unbound' },
|
|
77
|
+
cause: error
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=session-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-lifecycle.js","sourceRoot":"","sources":["../src/session-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,eAAe,EAAqB,MAAM,qBAAqB,CAAC;AAKzE,MAAM,UAAU,kCAAkC,CAAC,MAOlD;IACA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,0GAA0G;IAC1G,IAAI,cAAc,GAAkB,IAAI,CAAC;IAEzC,MAAM,kBAAkB,GACvB,MAAM,CAAC,kBAAkB;QACzB,CAAC,KAAK,IAA4B,EAAE;YACnC,MAAM,OAAO,GAAG,MAAM,OAAO,EAAE;iBAC7B,OAAO,C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SAAS,EAAE,IAAI;oBACf,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;oBAC1B,KAAK,EAAE,KAAK;iBACZ,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QACD,GAAG,EAAE,KAAK,IAAI,EAAE;YACf,MAAM,SAAS,GAAG,cAAc,CAAC;YACjC,cAAc,GAAG,IAAI,CAAC;YACtB,IAAI,SAAS,KAAK,IAAI;gBAAE,OAAO;YAC/B,IAAI,CAAC;gBACJ,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,6CAA6C,CAAC,CAAC;gBAC3F,MAAM,kBAAkB,CAAC;oBACxB,OAAO,EAAE,OAAO,EAAE;oBAClB,SAAS;oBACT,OAAO,EAAE,KAAK;oBACd,MAAM,EAAE,kBAAkB;iBAC1B,CAAC,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,MAAM,IAAI,eAAe,CAAC,kDAAkD,EAAE,aAAa,EAAE;oBAC5F,MAAM,EAAE,0BAA0B;oBAClC,SAAS,EAAE,IAAI;oBACf,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;oBAC5B,KAAK,EAAE,KAAK;iBACZ,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's workspace-effect preparer: before an action whose resolved
|
|
3
|
+
* `effects.homeWrite` is true, prove the host's home storage writable and bind
|
|
4
|
+
* the workspace environment, once per CLI. Every failure is one typed
|
|
5
|
+
* `UNAVAILABLE` refusal with a reason and value-free details (the SPEC's
|
|
6
|
+
* refusal table); nothing here touches a host API, so it runs on any host.
|
|
7
|
+
*/
|
|
8
|
+
import type { CLIInvocationInfo, CLIInvocationPreparer } from '@vibesdotdev/cli/schemas/surface';
|
|
9
|
+
export declare const CLI_HOME_WRITE_UNAVAILABLE_MESSAGE = "Writable Vibes home storage is required for this command but could not be initialized.";
|
|
10
|
+
export declare function createCliWorkspaceEffectPreparer(params: {
|
|
11
|
+
verifyHomeWrite: () => Promise<void>;
|
|
12
|
+
bind: (info: CLIInvocationInfo) => Promise<void>;
|
|
13
|
+
}): CLIInvocationPreparer;
|
|
14
|
+
//# sourceMappingURL=workspace-effect-preparer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-effect-preparer.d.ts","sourceRoot":"","sources":["../src/workspace-effect-preparer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGjG,eAAO,MAAM,kCAAkC,2FAC0C,CAAC;AAsC1F,wBAAgB,gCAAgC,CAAC,MAAM,EAAE;IACxD,eAAe,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD,GAAG,qBAAqB,CAmDxB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CapabilityError, CaughtFailureSchema, valueFreeFailure } from '@vibesdotdev/kernel';
|
|
2
|
+
export const CLI_HOME_WRITE_UNAVAILABLE_MESSAGE = 'Writable Vibes home storage is required for this command but could not be initialized.';
|
|
3
|
+
/** Filesystem codes that mean "not allowed to write here"; only these get the permissions hint. */
|
|
4
|
+
const HOME_WRITE_PERMISSION_CODES = new Set(['EACCES', 'EPERM', 'EROFS']);
|
|
5
|
+
/** An errno-shaped code (`ENOSPC`, `EACCES`), as opposed to a `CapabilityError` code (`UNAVAILABLE`). */
|
|
6
|
+
const ERRNO_CODE = /^E[A-Z0-9]{2,}$/;
|
|
7
|
+
/**
|
|
8
|
+
* The value-free facts of a caught preparation failure, read through the
|
|
9
|
+
* runtime's `valueFreeFailure`: an errno `code`, a typed failure's
|
|
10
|
+
* `failureReason` (and `failureCode`), or the failure's class name. A hostile
|
|
11
|
+
* value never throws here (`CaughtFailureSchema` and `valueFreeFailure` are total).
|
|
12
|
+
*/
|
|
13
|
+
function failureFacts(caught) {
|
|
14
|
+
const facts = valueFreeFailure(caught);
|
|
15
|
+
const details = {};
|
|
16
|
+
const errno = facts.reason === undefined && facts.code !== undefined && ERRNO_CODE.test(facts.code) ? facts.code : undefined;
|
|
17
|
+
if (errno !== undefined) {
|
|
18
|
+
details.code = errno;
|
|
19
|
+
return { errno, details, named: errno };
|
|
20
|
+
}
|
|
21
|
+
if (facts.reason === undefined)
|
|
22
|
+
details.failure = facts.name;
|
|
23
|
+
else
|
|
24
|
+
details.failureReason = facts.reason;
|
|
25
|
+
if (facts.code !== undefined)
|
|
26
|
+
details.failureCode = facts.code;
|
|
27
|
+
return { errno, details, named: facts.reason ?? facts.name };
|
|
28
|
+
}
|
|
29
|
+
export function createCliWorkspaceEffectPreparer(params) {
|
|
30
|
+
let bound = false;
|
|
31
|
+
return {
|
|
32
|
+
prepare: async (info) => {
|
|
33
|
+
if (!info.effects.homeWrite || bound)
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
await params.verifyHomeWrite();
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const { errno, details, named } = failureFacts(CaughtFailureSchema.parse(error));
|
|
40
|
+
if (errno !== undefined && HOME_WRITE_PERMISSION_CODES.has(errno)) {
|
|
41
|
+
throw new CapabilityError(CLI_HOME_WRITE_UNAVAILABLE_MESSAGE, 'UNAVAILABLE', {
|
|
42
|
+
reason: 'home-not-writable',
|
|
43
|
+
retryable: false,
|
|
44
|
+
recoveryHint: 'Check that ~/.vibes (or an explicitly overridden VIBES_HOME) is writable, then retry.',
|
|
45
|
+
details: { phase: 'home-write-probe', effect: 'homeWrite', ...details },
|
|
46
|
+
cause: error
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Not a permissions problem (ENOSPC, a typed refusal, an untyped
|
|
50
|
+
// failure): no permissions hint, and the failure's own facts name it.
|
|
51
|
+
throw new CapabilityError(`Vibes home storage could not be probed for writing (${named}).`, 'UNAVAILABLE', {
|
|
52
|
+
reason: 'home-write-unavailable',
|
|
53
|
+
retryable: false,
|
|
54
|
+
details: { phase: 'home-write-probe', effect: 'homeWrite', ...details },
|
|
55
|
+
cause: error
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
await params.bind(info);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
const { details } = failureFacts(CaughtFailureSchema.parse(error));
|
|
63
|
+
throw new CapabilityError('Vibes home storage is writable but the workspace could not be bound.', 'UNAVAILABLE', {
|
|
64
|
+
reason: 'workspace-bind-failed',
|
|
65
|
+
retryable: false,
|
|
66
|
+
details: { phase: 'workspace-bind', effect: 'workspaceBind', ...details },
|
|
67
|
+
cause: error
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
bound = true;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=workspace-effect-preparer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-effect-preparer.js","sourceRoot":"","sources":["../src/workspace-effect-preparer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAEjH,MAAM,CAAC,MAAM,kCAAkC,GAC9C,wFAAwF,CAAC;AAE1F,mGAAmG;AACnG,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/F,yGAAyG;AACzG,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAYrC;;;;;GAKG;AACH,SAAS,YAAY,CAAC,MAAqB;IAC1C,MAAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,OAAO,GAA2B,EAA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
|
|
2
2
|
"name": "@vibesdotdev/surface-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@vibesdotdev/filesystem": "^1.0.0-rc.2",
|
|
6
|
+
"@vibesdotdev/paths": "^1.0.0-rc.3",
|
|
7
|
+
"@vibesdotdev/kernel": "^1.0.0-rc.5",
|
|
8
|
+
"@vibesdotdev/host-node": "^1.0.0-rc.2",
|
|
9
|
+
"@vibesdotdev/kernel-rpc": "^1.0.0-rc.2",
|
|
10
|
+
"@vibesdotdev/session": "^1.0.0-rc.1",
|
|
11
|
+
"@vibesdotdev/workspace": "^1.0.0-rc.1",
|
|
12
|
+
"@vibesdotdev/config": "^1.0.0-rc.2",
|
|
13
|
+
"@vibesdotdev/storage": "^1.0.0-rc.2",
|
|
14
|
+
"zod": "^4.6.7"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@vibesdotdev/cli": "^1.0.0-rc.2",
|
|
18
|
+
"@vibesdotdev/host-bun": "^1.0.0-rc.2"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"bun": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./execution": {
|
|
29
|
+
"bun": "./dist/execution/index.js",
|
|
30
|
+
"types": "./dist/execution/index.d.ts",
|
|
31
|
+
"import": "./dist/execution/index.js",
|
|
32
|
+
"default": "./dist/execution/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./bun/host": {
|
|
35
|
+
"bun": "./dist/bun/host.js",
|
|
36
|
+
"types": "./dist/bun/host.d.ts",
|
|
37
|
+
"import": "./dist/bun/host.js",
|
|
38
|
+
"default": "./dist/bun/host.js"
|
|
39
|
+
},
|
|
40
|
+
"./bun/host-argv": {
|
|
41
|
+
"bun": "./dist/bun/host-argv.js",
|
|
42
|
+
"types": "./dist/bun/host-argv.d.ts",
|
|
43
|
+
"import": "./dist/bun/host-argv.js",
|
|
44
|
+
"default": "./dist/bun/host-argv.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist",
|
|
49
|
+
"README.md",
|
|
50
|
+
"LICENSE",
|
|
51
|
+
"bin",
|
|
52
|
+
"!dist/**/__tests__/**",
|
|
53
|
+
"!dist/**/__stubs__/**",
|
|
54
|
+
"!dist/**/*.test.js",
|
|
55
|
+
"!dist/**/*.test.js.map",
|
|
56
|
+
"!dist/**/*.test.d.ts",
|
|
57
|
+
"!dist/**/*.test.d.ts.map",
|
|
58
|
+
"!dist/**/*.spec.js",
|
|
59
|
+
"!dist/**/*.spec.js.map",
|
|
60
|
+
"!dist/**/*.spec.d.ts",
|
|
61
|
+
"!dist/**/*.spec.d.ts.map",
|
|
62
|
+
"!dist/**/*.tsbuildinfo"
|
|
63
|
+
],
|
|
64
|
+
"scripts": {
|
|
65
|
+
"lint": "node ../node_modules/@vibesdotdev/internal-oxlint-toolchain/ratchet.mjs .",
|
|
66
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
67
|
+
"check": "${BUN:-bun} --bun tsc -p tsconfig.json",
|
|
68
|
+
"test": "${BUN:-bun} test ./src ./test && ${BUN:-bun} run test:integration && ${BUN:-bun} run test:node",
|
|
69
|
+
"test:integration": "${BUN:-bun} test integration",
|
|
70
|
+
"test:node": "rm -rf .cache/node-run && ${BUN:-bun} build --target=node --conditions=bun --splitting --format=esm --external '@opentui/*' --outdir .cache/node-run/bundle src/__tests__/node-run/preparer.node-run.ts && node --test .cache/node-run/bundle/preparer.node-run.js"
|
|
71
|
+
},
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
|
|
75
|
+
"directory": "surface-cli"
|
|
76
|
+
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"registry": "https://packages.vibes.dev",
|
|
79
|
+
"access": "public"
|
|
80
|
+
},
|
|
81
|
+
"vibes": {
|
|
82
|
+
"visibility": "public",
|
|
83
|
+
"registry": {
|
|
84
|
+
"repositoryId": "4b1374d4-6830-4bfd-98e3-de66416368a8",
|
|
85
|
+
"directory": "surface-cli"
|
|
86
|
+
},
|
|
87
|
+
"handedRuntimeLogging": true,
|
|
88
|
+
"compositionRoots": [
|
|
89
|
+
"src/bun/host.ts",
|
|
90
|
+
"src/bun/external-hook-relay.ts",
|
|
91
|
+
"src/bun/host-argv.ts",
|
|
92
|
+
"dist/bun/host.js",
|
|
93
|
+
"dist/bun/host-argv.js"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"type": "module",
|
|
97
|
+
"types": "./dist/index.d.ts",
|
|
98
|
+
"license": "MIT",
|
|
99
|
+
"description": "CLI surface bootstrap for Vibes runtime applications.",
|
|
100
|
+
"homepage": "https://docs.vibes.dev/runtime-surface-cli",
|
|
101
|
+
"bugs": {
|
|
102
|
+
"url": "https://docs.vibes.dev/runtime-surface-cli#support"
|
|
103
|
+
},
|
|
104
|
+
"peerDependenciesMeta": {
|
|
105
|
+
"@vibesdotdev/host-bun": {
|
|
106
|
+
"optional": true
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"gitHead": "51230ebdad54bc405014633f435b499fa2a06b89",
|
|
110
|
+
"_vibes_source": {
|
|
111
|
+
"repo": "ssh://git@git.vibes.dev/vibesdotdev/framework.git",
|
|
112
|
+
"sha": "51230ebdad54bc405014633f435b499fa2a06b89",
|
|
113
|
+
"workspaceDigest": "sha256:166af3a843bba5e51bf197713862b1651972e39333402eb2f9fcc8d02d159575"
|
|
114
|
+
}
|
|
115
|
+
}
|