@vibest/cli 0.0.1-beta.19 → 0.0.1-beta.20
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/bin/vibest.cjs +23 -13
- package/harnesses/agy/.agents/plugins/vibest/hook.sh +48 -0
- package/harnesses/agy/.agents/plugins/vibest/hooks.json +38 -0
- package/harnesses/agy/.agents/plugins/vibest/plugin.json +5 -0
- package/harnesses/agy/.agents/plugins/vibest/skills/delegate/SKILL.md +66 -0
- package/harnesses/agy/.agents/plugins/vibest/skills/pipeline/SKILL.md +57 -0
- package/harnesses/agy/index.js +1405 -0
- package/harnesses/claude/.claude-plugin/plugin.json +2 -2
- package/harnesses/claude/README.md +17 -17
- package/harnesses/claude/hooks/hooks.json +1 -1
- package/harnesses/claude/hooks/register.mjs +154 -101
- package/harnesses/claude/skills/delegate/SKILL.md +18 -18
- package/harnesses/claude/skills/pipeline/SKILL.md +14 -14
- package/harnesses/cursor/.cursor-plugin/plugin.json +2 -2
- package/harnesses/cursor/hooks/hooks.json +3 -0
- package/harnesses/cursor/hooks/vibest.sh +3 -3
- package/harnesses/cursor/index.js +1340 -0
- package/harnesses/cursor/skills/delegate/SKILL.md +18 -18
- package/harnesses/cursor/skills/pipeline/SKILL.md +14 -14
- package/harnesses/pi/extension.mjs +643 -1112
- package/harnesses/pi/presentation.mjs +1023 -0
- package/harnesses/pi/skills/delegate/SKILL.md +18 -18
- package/harnesses/pi/skills/pipeline/SKILL.md +14 -14
- package/herdr-plugin/README.md +2 -2
- package/herdr-plugin/bin/vibest.sh +1 -1
- package/herdr-plugin/herdr-plugin.toml +5 -5
- package/package.json +17 -16
|
@@ -3121,6 +3121,9 @@ function isNever(_) {
|
|
|
3121
3121
|
function isUnknown(_) {
|
|
3122
3122
|
return true;
|
|
3123
3123
|
}
|
|
3124
|
+
function isObjectOrArray(input) {
|
|
3125
|
+
return typeof input === "object" && input !== null;
|
|
3126
|
+
}
|
|
3124
3127
|
function isObject(input) {
|
|
3125
3128
|
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
3126
3129
|
}
|
|
@@ -4285,6 +4288,7 @@ var Number2 = /* @__PURE__ */ make((self, that) => {
|
|
|
4285
4288
|
});
|
|
4286
4289
|
var mapInput = /* @__PURE__ */ dual(2, (self, f) => make((b1, b2) => self(f(b1), f(b2))));
|
|
4287
4290
|
var isGreaterThan = (O) => dual(2, (self, that) => O(self, that) === 1);
|
|
4291
|
+
var isGreaterThanOrEqualTo = (O) => dual(2, (self, that) => O(self, that) !== -1);
|
|
4288
4292
|
var min = (O) => dual(2, (self, that) => self === that || O(self, that) < 1 ? self : that);
|
|
4289
4293
|
|
|
4290
4294
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Option.js
|
|
@@ -4901,6 +4905,23 @@ var Equivalence = (self, that) => matchPair(self, that, {
|
|
|
4901
4905
|
onInfinity: (self, that) => self.value._tag === that.value._tag
|
|
4902
4906
|
});
|
|
4903
4907
|
var min2 = /* @__PURE__ */ min(Order);
|
|
4908
|
+
var sum = /* @__PURE__ */ dual(2, (self, that) => matchPair(self, that, {
|
|
4909
|
+
onMillis: (self, that) => make3(self + that),
|
|
4910
|
+
onNanos: (self, that) => make3(self + that),
|
|
4911
|
+
onInfinity: (self, that) => {
|
|
4912
|
+
const s = self.value._tag;
|
|
4913
|
+
const t = that.value._tag;
|
|
4914
|
+
if (s === "Infinity" && t === "NegativeInfinity")
|
|
4915
|
+
return zero;
|
|
4916
|
+
if (s === "NegativeInfinity" && t === "Infinity")
|
|
4917
|
+
return zero;
|
|
4918
|
+
if (s === "Infinity" || t === "Infinity")
|
|
4919
|
+
return infinity;
|
|
4920
|
+
if (s === "NegativeInfinity" || t === "NegativeInfinity")
|
|
4921
|
+
return negativeInfinity;
|
|
4922
|
+
return zero;
|
|
4923
|
+
}
|
|
4924
|
+
}));
|
|
4904
4925
|
var equals2 = /* @__PURE__ */ dual(2, (self, that) => Equivalence(self, that));
|
|
4905
4926
|
var parts = (self) => {
|
|
4906
4927
|
if (self.value._tag === "Infinity") {
|
|
@@ -5117,6 +5138,30 @@ var Class2 = class extends Class {
|
|
|
5117
5138
|
}
|
|
5118
5139
|
}
|
|
5119
5140
|
};
|
|
5141
|
+
var taggedEnum = () => new Proxy({}, {
|
|
5142
|
+
get(_target, tag, _receiver) {
|
|
5143
|
+
if (tag === "$is") {
|
|
5144
|
+
return isTagged;
|
|
5145
|
+
} else if (tag === "$match") {
|
|
5146
|
+
return taggedMatch;
|
|
5147
|
+
}
|
|
5148
|
+
return (props) => ({
|
|
5149
|
+
...props,
|
|
5150
|
+
_tag: tag
|
|
5151
|
+
});
|
|
5152
|
+
}
|
|
5153
|
+
});
|
|
5154
|
+
function taggedMatch() {
|
|
5155
|
+
if (arguments.length === 1) {
|
|
5156
|
+
const cases = arguments[0];
|
|
5157
|
+
return function(value) {
|
|
5158
|
+
return cases[value._tag](value);
|
|
5159
|
+
};
|
|
5160
|
+
}
|
|
5161
|
+
const value = arguments[0];
|
|
5162
|
+
const cases = arguments[1];
|
|
5163
|
+
return cases[value._tag](value);
|
|
5164
|
+
}
|
|
5120
5165
|
var Error3 = Error2;
|
|
5121
5166
|
var TaggedError2 = TaggedError;
|
|
5122
5167
|
|
|
@@ -13541,6 +13586,9 @@ function decodeUnknownEffect(schema, options) {
|
|
|
13541
13586
|
const parser = run2(schema.ast);
|
|
13542
13587
|
return options === undefined ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
13543
13588
|
}
|
|
13589
|
+
function decodeUnknownOption(schema, options) {
|
|
13590
|
+
return asOption(decodeUnknownEffect(schema, options));
|
|
13591
|
+
}
|
|
13544
13592
|
function encodeUnknownEffect(schema, options) {
|
|
13545
13593
|
const parser = run2(flip2(schema.ast));
|
|
13546
13594
|
return options === undefined ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
@@ -13583,6 +13631,17 @@ function runWithCompiler(compiler, ast) {
|
|
|
13583
13631
|
function asExit(parser) {
|
|
13584
13632
|
return (input, options) => runSyncExit2(parser(input, options));
|
|
13585
13633
|
}
|
|
13634
|
+
function asOption(parser) {
|
|
13635
|
+
const parserExit = asExit(parser);
|
|
13636
|
+
return (input, options) => {
|
|
13637
|
+
const exit = parserExit(input, options);
|
|
13638
|
+
if (isSuccess3(exit)) {
|
|
13639
|
+
return some2(exit.value);
|
|
13640
|
+
}
|
|
13641
|
+
getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
|
|
13642
|
+
return none2();
|
|
13643
|
+
};
|
|
13644
|
+
}
|
|
13586
13645
|
function runSync2(effect, message) {
|
|
13587
13646
|
const exit = runSyncExit2(effect);
|
|
13588
13647
|
if (isSuccess3(exit)) {
|
|
@@ -13950,6 +14009,7 @@ function decodeUnknownEffect2(schema, options) {
|
|
|
13950
14009
|
return fromIssueEffect(parser(input, options));
|
|
13951
14010
|
};
|
|
13952
14011
|
}
|
|
14012
|
+
var decodeUnknownOption2 = decodeUnknownOption;
|
|
13953
14013
|
function decodeUnknownSync(schema, options) {
|
|
13954
14014
|
const parser = decodeUnknownEffect2(schema, options);
|
|
13955
14015
|
return (input, options) => {
|
|
@@ -13975,6 +14035,9 @@ var make19 = make18;
|
|
|
13975
14035
|
function isSchema(u) {
|
|
13976
14036
|
return hasProperty(u, TypeId24) && u[TypeId24] === TypeId24;
|
|
13977
14037
|
}
|
|
14038
|
+
var optionalKey2 = /* @__PURE__ */ lambda((schema) => make19(optionalKey(schema.ast), {
|
|
14039
|
+
schema
|
|
14040
|
+
}));
|
|
13978
14041
|
var optional2 = /* @__PURE__ */ lambda((self) => {
|
|
13979
14042
|
const schema = UndefinedOr(self);
|
|
13980
14043
|
return make19(optional(self.ast), {
|
|
@@ -14067,12 +14130,6 @@ function Literals(literals) {
|
|
|
14067
14130
|
}
|
|
14068
14131
|
var NullOr = /* @__PURE__ */ lambda((self) => Union2([self, Null2]));
|
|
14069
14132
|
var UndefinedOr = /* @__PURE__ */ lambda((self) => Union2([self, Undefined2]));
|
|
14070
|
-
function brand(identifier) {
|
|
14071
|
-
return (schema) => make19(schema.ast, {
|
|
14072
|
-
schema,
|
|
14073
|
-
identifier
|
|
14074
|
-
});
|
|
14075
|
-
}
|
|
14076
14133
|
function decodeTo2(to, transformation) {
|
|
14077
14134
|
return (from) => {
|
|
14078
14135
|
return make19(decodeTo(from.ast, to.ast, transformation ? makeTransformation(transformation) : passthrough3()), {
|
|
@@ -14119,6 +14176,32 @@ function isPattern2(regExp, annotations) {
|
|
|
14119
14176
|
...annotations
|
|
14120
14177
|
});
|
|
14121
14178
|
}
|
|
14179
|
+
var getUUIDRegExp = (version) => {
|
|
14180
|
+
if (version) {
|
|
14181
|
+
return new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
14182
|
+
}
|
|
14183
|
+
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;
|
|
14184
|
+
};
|
|
14185
|
+
function isUUID(version, annotations) {
|
|
14186
|
+
const regExp = getUUIDRegExp(version);
|
|
14187
|
+
return isPattern2(regExp, {
|
|
14188
|
+
expected: version ? `a UUID v${version}` : "a UUID",
|
|
14189
|
+
representation: {
|
|
14190
|
+
id: "effect/schema/isUUID",
|
|
14191
|
+
payload: {
|
|
14192
|
+
version: version ?? null
|
|
14193
|
+
}
|
|
14194
|
+
},
|
|
14195
|
+
toJsonSchema: () => ({
|
|
14196
|
+
pattern: regExp.source,
|
|
14197
|
+
format: "uuid"
|
|
14198
|
+
}),
|
|
14199
|
+
toCode: () => ({
|
|
14200
|
+
runtime: version === undefined ? "Schema.isUUID()" : `Schema.isUUID(${version})`
|
|
14201
|
+
}),
|
|
14202
|
+
...annotations
|
|
14203
|
+
});
|
|
14204
|
+
}
|
|
14122
14205
|
function isBase64(annotations) {
|
|
14123
14206
|
const regExp = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
14124
14207
|
return isPattern2(regExp, {
|
|
@@ -14137,6 +14220,77 @@ function isBase64(annotations) {
|
|
|
14137
14220
|
});
|
|
14138
14221
|
}
|
|
14139
14222
|
var Finite = /* @__PURE__ */ make19(finite);
|
|
14223
|
+
function makeIsGreaterThan(options) {
|
|
14224
|
+
const gt = isGreaterThan(options.order);
|
|
14225
|
+
const formatter = options.formatter ?? format;
|
|
14226
|
+
return (exclusiveMinimum, annotations) => {
|
|
14227
|
+
return makeFilter2((input) => gt(input, exclusiveMinimum), {
|
|
14228
|
+
expected: `a value greater than ${formatter(exclusiveMinimum)}`,
|
|
14229
|
+
arbitraryConstraint: {
|
|
14230
|
+
order: options.order,
|
|
14231
|
+
minimum: exclusiveMinimum,
|
|
14232
|
+
exclusiveMinimum: true
|
|
14233
|
+
},
|
|
14234
|
+
...options.annotate?.(exclusiveMinimum),
|
|
14235
|
+
...annotations
|
|
14236
|
+
});
|
|
14237
|
+
};
|
|
14238
|
+
}
|
|
14239
|
+
function makeIsGreaterThanOrEqualTo(options) {
|
|
14240
|
+
const gte = isGreaterThanOrEqualTo(options.order);
|
|
14241
|
+
const formatter = options.formatter ?? format;
|
|
14242
|
+
return (minimum, annotations) => {
|
|
14243
|
+
return makeFilter2((input) => gte(input, minimum), {
|
|
14244
|
+
expected: `a value greater than or equal to ${formatter(minimum)}`,
|
|
14245
|
+
arbitraryConstraint: {
|
|
14246
|
+
order: options.order,
|
|
14247
|
+
minimum
|
|
14248
|
+
},
|
|
14249
|
+
...options.annotate?.(minimum),
|
|
14250
|
+
...annotations
|
|
14251
|
+
});
|
|
14252
|
+
};
|
|
14253
|
+
}
|
|
14254
|
+
function encodeNumberPayload(number) {
|
|
14255
|
+
if (!globalThis.Number.isFinite(number)) {
|
|
14256
|
+
throw new globalThis.RangeError(`Expected a finite number, got ${format(number)}`);
|
|
14257
|
+
}
|
|
14258
|
+
return number;
|
|
14259
|
+
}
|
|
14260
|
+
var isGreaterThan2 = /* @__PURE__ */ makeIsGreaterThan({
|
|
14261
|
+
order: Number2,
|
|
14262
|
+
annotate: (exclusiveMinimum) => ({
|
|
14263
|
+
representation: {
|
|
14264
|
+
id: "effect/schema/isGreaterThan",
|
|
14265
|
+
payload: {
|
|
14266
|
+
exclusiveMinimum: encodeNumberPayload(exclusiveMinimum)
|
|
14267
|
+
}
|
|
14268
|
+
},
|
|
14269
|
+
toJsonSchema: () => ({
|
|
14270
|
+
exclusiveMinimum
|
|
14271
|
+
}),
|
|
14272
|
+
toCode: () => ({
|
|
14273
|
+
runtime: `Schema.isGreaterThan(${format(exclusiveMinimum)})`
|
|
14274
|
+
})
|
|
14275
|
+
})
|
|
14276
|
+
});
|
|
14277
|
+
var isGreaterThanOrEqualTo2 = /* @__PURE__ */ makeIsGreaterThanOrEqualTo({
|
|
14278
|
+
order: Number2,
|
|
14279
|
+
annotate: (minimum) => ({
|
|
14280
|
+
representation: {
|
|
14281
|
+
id: "effect/schema/isGreaterThanOrEqualTo",
|
|
14282
|
+
payload: {
|
|
14283
|
+
minimum: encodeNumberPayload(minimum)
|
|
14284
|
+
}
|
|
14285
|
+
},
|
|
14286
|
+
toJsonSchema: () => ({
|
|
14287
|
+
minimum
|
|
14288
|
+
}),
|
|
14289
|
+
toCode: () => ({
|
|
14290
|
+
runtime: `Schema.isGreaterThanOrEqualTo(${format(minimum)})`
|
|
14291
|
+
})
|
|
14292
|
+
})
|
|
14293
|
+
});
|
|
14140
14294
|
function isInt(annotations) {
|
|
14141
14295
|
return makeFilter2((n) => globalThis.Number.isSafeInteger(n), {
|
|
14142
14296
|
expected: "an integer",
|
|
@@ -14157,6 +14311,41 @@ function isInt(annotations) {
|
|
|
14157
14311
|
});
|
|
14158
14312
|
}
|
|
14159
14313
|
var Int = /* @__PURE__ */ Number5.check(/* @__PURE__ */ isInt());
|
|
14314
|
+
function makeIsMinLength(minLength, minCodePoints, annotations) {
|
|
14315
|
+
return makeFilter2((input) => input.length >= minLength, {
|
|
14316
|
+
expected: `a value with a length of at least ${minLength}`,
|
|
14317
|
+
representation: {
|
|
14318
|
+
id: "effect/schema/isMinLength",
|
|
14319
|
+
payload: {
|
|
14320
|
+
minLength
|
|
14321
|
+
}
|
|
14322
|
+
},
|
|
14323
|
+
toJsonSchema: ({
|
|
14324
|
+
type
|
|
14325
|
+
}) => type === "string" ? minLength <= 1 ? {
|
|
14326
|
+
minLength: minCodePoints
|
|
14327
|
+
} : [{
|
|
14328
|
+
minLength: minCodePoints
|
|
14329
|
+
}, true] : type === "array" ? {
|
|
14330
|
+
minItems: minLength
|
|
14331
|
+
} : type === undefined ? [{
|
|
14332
|
+
minLength: minCodePoints,
|
|
14333
|
+
minItems: minLength
|
|
14334
|
+
}, true] : [{}, true],
|
|
14335
|
+
toCode: () => ({
|
|
14336
|
+
runtime: `Schema.isMinLength(${minLength})`
|
|
14337
|
+
}),
|
|
14338
|
+
[STRUCTURAL_ANNOTATION_KEY]: true,
|
|
14339
|
+
arbitraryConstraint: {
|
|
14340
|
+
minLength
|
|
14341
|
+
},
|
|
14342
|
+
...annotations
|
|
14343
|
+
});
|
|
14344
|
+
}
|
|
14345
|
+
function isNonEmpty(annotations) {
|
|
14346
|
+
return makeIsMinLength(1, 1, annotations);
|
|
14347
|
+
}
|
|
14348
|
+
var NonEmptyString = /* @__PURE__ */ String4.check(/* @__PURE__ */ isNonEmpty());
|
|
14160
14349
|
var getErrorOptionsKey = (options) => (options?.includeStack === true ? 1 : 0) | (options?.excludeCause === true ? 2 : 0);
|
|
14161
14350
|
var getErrorOptions = (key) => {
|
|
14162
14351
|
switch (key) {
|
|
@@ -14355,6 +14544,7 @@ var Uint8Array2 = /* @__PURE__ */ instanceOf(globalThis.Uint8Array, {
|
|
|
14355
14544
|
expected: "Uint8Array",
|
|
14356
14545
|
toCodecJson: () => link3()(Base64String, uint8ArrayFromBase64String)
|
|
14357
14546
|
});
|
|
14547
|
+
var Uint8ArrayFromBase64 = /* @__PURE__ */ Base64String.pipe(/* @__PURE__ */ decodeTo2(Uint8Array2, uint8ArrayFromBase64String));
|
|
14358
14548
|
function CauseReason(error, defect) {
|
|
14359
14549
|
const schema = declareConstructor()([error, defect], ([error, defect]) => (input, ast, options) => {
|
|
14360
14550
|
if (!isReason(input)) {
|
|
@@ -15141,8 +15331,10 @@ var fromDuplex = (open, options) => withFiber2((fiber) => {
|
|
|
15141
15331
|
}));
|
|
15142
15332
|
});
|
|
15143
15333
|
|
|
15334
|
+
// ../../schema/src/version.ts
|
|
15335
|
+
var PROTOCOL = 11;
|
|
15336
|
+
|
|
15144
15337
|
// ../../protocol/src/protocol.ts
|
|
15145
|
-
var PROTOCOL = 8;
|
|
15146
15338
|
var MISMATCH_ACTION = "vibest update";
|
|
15147
15339
|
var protocolMismatch = (caller, server, version, callerVersion) => ({
|
|
15148
15340
|
protocol: server,
|
|
@@ -15156,32 +15348,27 @@ var SESSION_HEADER = "vibest-session-id";
|
|
|
15156
15348
|
var REPOSITORY_HEADER = "vibest-repository";
|
|
15157
15349
|
var PROJECT_HEADER = "vibest-project-id";
|
|
15158
15350
|
var HARNESS_SESSION_HEADER = "vibest-harness-session-id";
|
|
15159
|
-
var AGENT_HEADER = "vibest-agent";
|
|
15160
15351
|
var HARNESS_HEADER = "vibest-harness";
|
|
15161
15352
|
var CWD_HEADER = "vibest-cwd";
|
|
15162
15353
|
var RUNTIME_HEADER = "vibest-runtime";
|
|
15163
15354
|
var PLUGIN_VERSION_HEADER = "vibest-plugin-version";
|
|
15164
|
-
var
|
|
15165
|
-
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
if (who.repositoryRoot !== undefined)
|
|
15182
|
-
headers[REPOSITORY_HEADER] = who.repositoryRoot;
|
|
15183
|
-
return headers;
|
|
15184
|
-
};
|
|
15355
|
+
var PROCESS_HEADER = "vibest-process";
|
|
15356
|
+
var presentHeaders = (headers) => Object.fromEntries(headers.flatMap(([name, value]) => value ? [[name, value]] : []));
|
|
15357
|
+
var sessionHeaders = (who) => ({
|
|
15358
|
+
[PROTOCOL_HEADER]: String(PROTOCOL),
|
|
15359
|
+
[CALLER_HEADER]: "session",
|
|
15360
|
+
[SESSION_HEADER]: who.sessionId,
|
|
15361
|
+
...presentHeaders([
|
|
15362
|
+
[PROJECT_HEADER, who.projectId],
|
|
15363
|
+
[HARNESS_SESSION_HEADER, who.harnessSessionId],
|
|
15364
|
+
[HARNESS_HEADER, who.harness],
|
|
15365
|
+
[CWD_HEADER, who.cwd === undefined ? undefined : encodeURIComponent(who.cwd)],
|
|
15366
|
+
[RUNTIME_HEADER, who.runtime],
|
|
15367
|
+
[PLUGIN_VERSION_HEADER, who.pluginVersion],
|
|
15368
|
+
[PROCESS_HEADER, who.process]
|
|
15369
|
+
]),
|
|
15370
|
+
...who.repositoryRoot !== undefined && { [REPOSITORY_HEADER]: who.repositoryRoot }
|
|
15371
|
+
});
|
|
15185
15372
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/ConfigProvider.js
|
|
15186
15373
|
function makeValue(value) {
|
|
15187
15374
|
return {
|
|
@@ -15570,6 +15757,9 @@ var makeUnsafe6 = (value) => {
|
|
|
15570
15757
|
var make24 = (value) => sync2(() => makeUnsafe6(value));
|
|
15571
15758
|
var get2 = (self) => sync2(() => self.ref.current);
|
|
15572
15759
|
var set2 = /* @__PURE__ */ dual(2, (self, value) => sync2(() => set(self.ref, value)));
|
|
15760
|
+
// ../../schema/src/id.ts
|
|
15761
|
+
var RequestId = String4.check(isUUID(4));
|
|
15762
|
+
|
|
15573
15763
|
// ../../schema/src/machine.ts
|
|
15574
15764
|
class MachineFailed extends TaggedError3()("MachineFailed", { message: String4 }) {
|
|
15575
15765
|
}
|
|
@@ -15659,63 +15849,13 @@ var OutboxItem = Struct({
|
|
|
15659
15849
|
id: String4,
|
|
15660
15850
|
session: String4,
|
|
15661
15851
|
recipient: String4,
|
|
15662
|
-
kind: Literals(["
|
|
15852
|
+
kind: Literals(["send", "notice"]),
|
|
15663
15853
|
content: String4,
|
|
15664
15854
|
cut: optional2(Boolean3)
|
|
15665
15855
|
});
|
|
15666
15856
|
|
|
15667
|
-
// ../../schema/src/id.ts
|
|
15668
|
-
var ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
15669
|
-
|
|
15670
15857
|
// ../../schema/src/model.ts
|
|
15671
|
-
var ProjectID = brand("ProjectID")(String4.check(isPattern2(ID)));
|
|
15672
|
-
var SessionID = brand("SessionID")(String4.check(isPattern2(ID)));
|
|
15673
|
-
var InboxID = brand("InboxID")(Int);
|
|
15674
|
-
var MessageID = brand("MessageID")(Int);
|
|
15675
|
-
var Time = Number5;
|
|
15676
|
-
var Json3 = Record(String4, Unknown2);
|
|
15677
|
-
var Project = Struct({
|
|
15678
|
-
id: ProjectID,
|
|
15679
|
-
directory: String4,
|
|
15680
|
-
mainSessionId: optional2(SessionID)
|
|
15681
|
-
});
|
|
15682
|
-
var Runtime = Json3;
|
|
15683
|
-
var Session = Struct({
|
|
15684
|
-
id: SessionID,
|
|
15685
|
-
projectId: ProjectID,
|
|
15686
|
-
parentSessionId: optional2(SessionID),
|
|
15687
|
-
agentType: String4,
|
|
15688
|
-
harness: String4,
|
|
15689
|
-
directory: String4,
|
|
15690
|
-
runtime: optional2(Runtime),
|
|
15691
|
-
harnessSessionId: optional2(String4),
|
|
15692
|
-
metadata: Json3,
|
|
15693
|
-
createdAt: Time,
|
|
15694
|
-
endedAt: optional2(Time)
|
|
15695
|
-
});
|
|
15696
|
-
var SenderType = Literals(["user", "session", "system", "plugin"]);
|
|
15697
|
-
var DeliveryStatus = Literals(["pending", "delivering", "delivered", "failed", "dropped"]);
|
|
15698
|
-
var Inbox = Struct({
|
|
15699
|
-
id: InboxID,
|
|
15700
|
-
recipientSessionId: SessionID,
|
|
15701
|
-
senderType: SenderType,
|
|
15702
|
-
senderId: optional2(String4),
|
|
15703
|
-
content: String4,
|
|
15704
|
-
resultMessageId: optional2(MessageID),
|
|
15705
|
-
deliveryStatus: DeliveryStatus
|
|
15706
|
-
});
|
|
15707
15858
|
var MessageStatus = Literals(["working", "completed", "failed", "interrupted", "lost", "not_started"]);
|
|
15708
|
-
var Message = Struct({
|
|
15709
|
-
id: MessageID,
|
|
15710
|
-
sessionId: SessionID,
|
|
15711
|
-
inboxId: optional2(InboxID),
|
|
15712
|
-
input: String4,
|
|
15713
|
-
output: optional2(String4),
|
|
15714
|
-
status: MessageStatus,
|
|
15715
|
-
metadata: Json3,
|
|
15716
|
-
startedAt: Time,
|
|
15717
|
-
endedAt: optional2(Time)
|
|
15718
|
-
});
|
|
15719
15859
|
|
|
15720
15860
|
// ../../schema/src/plugin.ts
|
|
15721
15861
|
class AgentRefused extends TaggedError3()("AgentRefused", {
|
|
@@ -15729,6 +15869,14 @@ class AgentRefused extends TaggedError3()("AgentRefused", {
|
|
|
15729
15869
|
|
|
15730
15870
|
class HookFailed extends TaggedError3()("HookFailed", { message: String4 }) {
|
|
15731
15871
|
}
|
|
15872
|
+
|
|
15873
|
+
class PluginsNotActive extends TaggedError3()("PluginsNotActive", {
|
|
15874
|
+
plugins: ArraySchema(String4)
|
|
15875
|
+
}) {
|
|
15876
|
+
get message() {
|
|
15877
|
+
return this.plugins.length === 0 ? "plugins still loading" : `plugins still loading: ${this.plugins.join(", ")}`;
|
|
15878
|
+
}
|
|
15879
|
+
}
|
|
15732
15880
|
var Change = Struct({
|
|
15733
15881
|
field: String4,
|
|
15734
15882
|
from: optional2(Unknown2),
|
|
@@ -15773,6 +15921,12 @@ var ProjectInfoResult = Struct({
|
|
|
15773
15921
|
artifacts: String4
|
|
15774
15922
|
});
|
|
15775
15923
|
var ProjectSearchInput = Struct({ query: String4, kind: optional2(ProjectKind) });
|
|
15924
|
+
var ProjectActivity = Literals(["blocked", "done", "working", "idle"]);
|
|
15925
|
+
|
|
15926
|
+
class ProjectCreateFailed extends TaggedError3()("ProjectCreateFailed", {
|
|
15927
|
+
message: String4
|
|
15928
|
+
}) {
|
|
15929
|
+
}
|
|
15776
15930
|
|
|
15777
15931
|
// ../../schema/src/remove.ts
|
|
15778
15932
|
var RemoveOutcome = Struct({
|
|
@@ -15786,11 +15940,151 @@ var RemoveOutcome = Struct({
|
|
|
15786
15940
|
reasons: ArraySchema(String4)
|
|
15787
15941
|
});
|
|
15788
15942
|
|
|
15943
|
+
// ../../schema/src/event.ts
|
|
15944
|
+
var fact = (type, aggregate, fields) => ({ type, aggregate, data: Struct(fields) });
|
|
15945
|
+
var Text = NonEmptyString;
|
|
15946
|
+
var optional3 = (schema) => optionalKey2(schema);
|
|
15947
|
+
var Seq = Int.check(isGreaterThan2(0));
|
|
15948
|
+
var Pid = Int.check(isGreaterThan2(0));
|
|
15949
|
+
var Repository = Struct({ path: Text, remote: optional3(Text) });
|
|
15950
|
+
var Repositories = ArraySchema(Repository);
|
|
15951
|
+
var ProjectCreated = fact("project.created", "project", {
|
|
15952
|
+
directory: optional3(Text),
|
|
15953
|
+
repositories: Repositories
|
|
15954
|
+
});
|
|
15955
|
+
var ProjectMoved = fact("project.moved", "project", { from: Text, to: Text, repositories: Repositories });
|
|
15956
|
+
var ProjectRepositoriesChanged = fact("project.repositories_changed", "project", {
|
|
15957
|
+
repositories: Repositories
|
|
15958
|
+
});
|
|
15959
|
+
var ProjectEntryChanged = fact("project.entry_changed", "project", { session: optional3(Text) });
|
|
15960
|
+
var SessionCreated = fact("session.created", "session", {
|
|
15961
|
+
project: Text,
|
|
15962
|
+
agent: Text,
|
|
15963
|
+
name: Text,
|
|
15964
|
+
directory: String4,
|
|
15965
|
+
parent: optional3(Text),
|
|
15966
|
+
origin: optional3(Struct({ peer: Text, project: Text, session: optional3(Text) }))
|
|
15967
|
+
});
|
|
15968
|
+
var SessionRenamed = fact("session.renamed", "session", { name: Text });
|
|
15969
|
+
var SessionDirectoryChanged = fact("session.directory_changed", "session", { directory: Text });
|
|
15970
|
+
var SessionEnded = fact("session.ended", "session", { reason: Literals(["archived", "replaced"]) });
|
|
15971
|
+
var ProcessStarted = fact("process.started", "session", {
|
|
15972
|
+
harness: Text,
|
|
15973
|
+
provider: optional3(Text),
|
|
15974
|
+
model: optional3(Text),
|
|
15975
|
+
routing: optional3(Routing),
|
|
15976
|
+
resume: optional3(Text),
|
|
15977
|
+
runtime: Text,
|
|
15978
|
+
terminal: optional3(Text),
|
|
15979
|
+
pid: optional3(Pid)
|
|
15980
|
+
});
|
|
15981
|
+
var ProcessPlaced = fact("process.placed", "session", { process: Seq, terminal: Text, pid: optional3(Pid) });
|
|
15982
|
+
var ProcessReady = fact("process.ready", "session", {
|
|
15983
|
+
process: Seq,
|
|
15984
|
+
pid: optional3(Pid),
|
|
15985
|
+
integration: optional3(Struct({ version: Text, protocol: Int }))
|
|
15986
|
+
});
|
|
15987
|
+
var ProcessPid = fact("process.pid", "session", { process: Seq, pid: Pid });
|
|
15988
|
+
var ProcessConversation = fact("process.conversation", "session", { process: Seq, conversation: Text });
|
|
15989
|
+
var ProcessEndReason = Literals([
|
|
15990
|
+
"exited",
|
|
15991
|
+
"limited",
|
|
15992
|
+
"restart",
|
|
15993
|
+
"move",
|
|
15994
|
+
"archived",
|
|
15995
|
+
"launch_failed",
|
|
15996
|
+
"superseded"
|
|
15997
|
+
]);
|
|
15998
|
+
var ProcessEnded = fact("process.ended", "session", { process: Seq, reason: ProcessEndReason });
|
|
15999
|
+
var ExecutionStarted = fact("execution.started", "session", {
|
|
16000
|
+
process: optional3(Seq),
|
|
16001
|
+
typed: optional3(Text)
|
|
16002
|
+
});
|
|
16003
|
+
var ExecutionAccepted = fact("execution.accepted", "session", { execution: Seq });
|
|
16004
|
+
var ExecutionOutcome = Literals(["completed", "failed", "interrupted", "lost", "not_started"]);
|
|
16005
|
+
var ExecutionEnded = fact("execution.ended", "session", {
|
|
16006
|
+
execution: Seq,
|
|
16007
|
+
outcome: ExecutionOutcome,
|
|
16008
|
+
failure: optional3(Struct({ message: Text, kind: optional3(Literal2("limit")) })),
|
|
16009
|
+
conversation: optional3(Text),
|
|
16010
|
+
reply: optional3(String4)
|
|
16011
|
+
});
|
|
16012
|
+
var InboxKind = Literals(["task", "send", "notice"]);
|
|
16013
|
+
var InboxQueued = fact("inbox.queued", "session", {
|
|
16014
|
+
kind: InboxKind,
|
|
16015
|
+
recipient: optional3(Text),
|
|
16016
|
+
sender: optional3(Text),
|
|
16017
|
+
content: String4,
|
|
16018
|
+
status: Literals(["pending", "delivered", "dropped"]),
|
|
16019
|
+
request: optional3(Text),
|
|
16020
|
+
peerItem: optional3(Text)
|
|
16021
|
+
});
|
|
16022
|
+
var InboxMoved = fact("inbox.moved", "session", {
|
|
16023
|
+
inbox: Seq,
|
|
16024
|
+
to: Literals(["pending", "delivering", "delivered", "failed", "dropped"]),
|
|
16025
|
+
execution: optional3(Seq)
|
|
16026
|
+
});
|
|
16027
|
+
var MachineAdded = fact("machine.added", "ledger", { name: Text, target: Text, vibestd: Text });
|
|
16028
|
+
var MachineConnected = fact("machine.connected", "ledger", { name: Text });
|
|
16029
|
+
var MachineRemoved = fact("machine.removed", "ledger", { name: Text });
|
|
16030
|
+
var PeerSeen = fact("peer.seen", "ledger", { id: Text, name: Text });
|
|
16031
|
+
var OutboxQueued = fact("outbox.queued", "ledger", {
|
|
16032
|
+
id: Text,
|
|
16033
|
+
peer: Text,
|
|
16034
|
+
session: Text,
|
|
16035
|
+
recipient: optional3(Text),
|
|
16036
|
+
kind: optional3(Literals(["send", "notice"])),
|
|
16037
|
+
content: String4
|
|
16038
|
+
});
|
|
16039
|
+
var OutboxAcked = fact("outbox.acked", "ledger", { peer: Text, ids: NonEmptyArray(Text) });
|
|
16040
|
+
var Catalog = {
|
|
16041
|
+
[ProjectCreated.type]: ProjectCreated,
|
|
16042
|
+
[ProjectMoved.type]: ProjectMoved,
|
|
16043
|
+
[ProjectRepositoriesChanged.type]: ProjectRepositoriesChanged,
|
|
16044
|
+
[ProjectEntryChanged.type]: ProjectEntryChanged,
|
|
16045
|
+
[SessionCreated.type]: SessionCreated,
|
|
16046
|
+
[SessionRenamed.type]: SessionRenamed,
|
|
16047
|
+
[SessionDirectoryChanged.type]: SessionDirectoryChanged,
|
|
16048
|
+
[SessionEnded.type]: SessionEnded,
|
|
16049
|
+
[ProcessStarted.type]: ProcessStarted,
|
|
16050
|
+
[ProcessPlaced.type]: ProcessPlaced,
|
|
16051
|
+
[ProcessReady.type]: ProcessReady,
|
|
16052
|
+
[ProcessPid.type]: ProcessPid,
|
|
16053
|
+
[ProcessConversation.type]: ProcessConversation,
|
|
16054
|
+
[ProcessEnded.type]: ProcessEnded,
|
|
16055
|
+
[ExecutionStarted.type]: ExecutionStarted,
|
|
16056
|
+
[ExecutionAccepted.type]: ExecutionAccepted,
|
|
16057
|
+
[ExecutionEnded.type]: ExecutionEnded,
|
|
16058
|
+
[InboxQueued.type]: InboxQueued,
|
|
16059
|
+
[InboxMoved.type]: InboxMoved,
|
|
16060
|
+
[MachineAdded.type]: MachineAdded,
|
|
16061
|
+
[MachineConnected.type]: MachineConnected,
|
|
16062
|
+
[MachineRemoved.type]: MachineRemoved,
|
|
16063
|
+
[PeerSeen.type]: PeerSeen,
|
|
16064
|
+
[OutboxQueued.type]: OutboxQueued,
|
|
16065
|
+
[OutboxAcked.type]: OutboxAcked
|
|
16066
|
+
};
|
|
16067
|
+
var byType = new Map(Object.values(Catalog).map((d) => [d.type, d]));
|
|
16068
|
+
class UnknownFact extends TaggedError3()("UnknownFact", {
|
|
16069
|
+
aggregate: String4,
|
|
16070
|
+
seq: Number5,
|
|
16071
|
+
type: String4,
|
|
16072
|
+
message: String4
|
|
16073
|
+
}) {
|
|
16074
|
+
}
|
|
16075
|
+
|
|
15789
16076
|
// ../../schema/src/session.ts
|
|
15790
16077
|
var AgentStatus = Literals(["idle", "working", "blocked", "done", "unknown"]);
|
|
15791
|
-
var
|
|
15792
|
-
|
|
15793
|
-
|
|
16078
|
+
var ExecutionState = Literals([
|
|
16079
|
+
"none",
|
|
16080
|
+
"open",
|
|
16081
|
+
"completed",
|
|
16082
|
+
"failed",
|
|
16083
|
+
"interrupted",
|
|
16084
|
+
"lost",
|
|
16085
|
+
"not_started"
|
|
16086
|
+
]);
|
|
16087
|
+
var InboxStatus = Literals(["pending", "delivering", "delivered", "failed", "dropped"]);
|
|
15794
16088
|
var RuntimeAddress = Struct({
|
|
15795
16089
|
machine: String4,
|
|
15796
16090
|
id: String4
|
|
@@ -15805,14 +16099,12 @@ var RuntimeMachine = Struct({
|
|
|
15805
16099
|
});
|
|
15806
16100
|
var InboxRow = Struct({
|
|
15807
16101
|
id: Number5,
|
|
15808
|
-
|
|
16102
|
+
sender: NullOr(String4),
|
|
16103
|
+
recipient: NullOr(String4),
|
|
15809
16104
|
kind: InboxKind,
|
|
15810
16105
|
message: String4,
|
|
15811
|
-
|
|
15812
|
-
status: InboxStatus,
|
|
15813
|
-
createdAt: Number5
|
|
16106
|
+
status: InboxStatus
|
|
15814
16107
|
});
|
|
15815
|
-
|
|
15816
16108
|
class HarnessUnavailable extends TaggedError3()("HarnessUnavailable", {
|
|
15817
16109
|
harness: String4,
|
|
15818
16110
|
message: String4
|
|
@@ -15849,14 +16141,9 @@ class AmbiguousSession extends TaggedError3()("AmbiguousSession", {
|
|
|
15849
16141
|
}
|
|
15850
16142
|
}
|
|
15851
16143
|
|
|
15852
|
-
class
|
|
15853
|
-
|
|
15854
|
-
from: String4,
|
|
15855
|
-
to: String4
|
|
16144
|
+
class MoveRefused extends TaggedError3()("MoveRefused", {
|
|
16145
|
+
message: String4
|
|
15856
16146
|
}) {
|
|
15857
|
-
get message() {
|
|
15858
|
-
return `the project moved from ${this.from} to ${this.to}; run vibest here to move it`;
|
|
15859
|
-
}
|
|
15860
16147
|
}
|
|
15861
16148
|
|
|
15862
16149
|
class AllocationFailed extends TaggedError3()("AllocationFailed", {
|
|
@@ -15882,9 +16169,28 @@ class NotReady extends TaggedError3()("NotReady", {
|
|
|
15882
16169
|
}) {
|
|
15883
16170
|
}
|
|
15884
16171
|
|
|
15885
|
-
class
|
|
16172
|
+
class NoCallingSession extends TaggedError3()("NoCallingSession", {}) {
|
|
15886
16173
|
get message() {
|
|
15887
|
-
return "
|
|
16174
|
+
return "vibest run is run by an agent in a session; to start working, run vibest in a terminal";
|
|
16175
|
+
}
|
|
16176
|
+
}
|
|
16177
|
+
|
|
16178
|
+
class UnknownAgent extends TaggedError3()("UnknownAgent", {
|
|
16179
|
+
agent: String4,
|
|
16180
|
+
known: ArraySchema(Struct({ id: String4, description: String4 }))
|
|
16181
|
+
}) {
|
|
16182
|
+
get message() {
|
|
16183
|
+
const known = this.known.map((definition) => `${definition.id} (${definition.description})`).join("; ");
|
|
16184
|
+
return `no agent definition ${this.agent}; registered: ${known || "none"}`;
|
|
16185
|
+
}
|
|
16186
|
+
}
|
|
16187
|
+
var runnableNote = (runnable) => runnable.length === 0 ? "" : `; this machine can run: ${runnable.join(", ")}`;
|
|
16188
|
+
|
|
16189
|
+
class NoHarnessChosen extends TaggedError3()("NoHarnessChosen", {
|
|
16190
|
+
runnable: ArraySchema(String4)
|
|
16191
|
+
}) {
|
|
16192
|
+
get message() {
|
|
16193
|
+
return `no harness to inherit: name one, for example \`vibest run claude -- <prompt>\`${runnableNote(this.runnable)}`;
|
|
15888
16194
|
}
|
|
15889
16195
|
}
|
|
15890
16196
|
|
|
@@ -15898,6 +16204,18 @@ class NotInRepository extends TaggedError3()("NotInRepository", { path: String4
|
|
|
15898
16204
|
return `${this.path} is not inside a git repository`;
|
|
15899
16205
|
}
|
|
15900
16206
|
}
|
|
16207
|
+
var HarnessModel = Struct({
|
|
16208
|
+
provider: NullOr(String4),
|
|
16209
|
+
model: String4,
|
|
16210
|
+
name: String4,
|
|
16211
|
+
default: Boolean3
|
|
16212
|
+
});
|
|
16213
|
+
var HarnessChoice = Struct({
|
|
16214
|
+
harness: String4,
|
|
16215
|
+
binary: String4,
|
|
16216
|
+
problem: NullOr(String4),
|
|
16217
|
+
models: ArraySchema(HarnessModel)
|
|
16218
|
+
});
|
|
15901
16219
|
|
|
15902
16220
|
// ../../schema/src/subscription.ts
|
|
15903
16221
|
var SubscriptionAccount = Struct({
|
|
@@ -16176,7 +16494,7 @@ class RpcClientError extends (/* @__PURE__ */ Error4(TypeId31)({
|
|
|
16176
16494
|
}
|
|
16177
16495
|
|
|
16178
16496
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/rpc/RpcMessage.js
|
|
16179
|
-
var
|
|
16497
|
+
var RequestId2 = (id) => id;
|
|
16180
16498
|
var constPing = {
|
|
16181
16499
|
_tag: "Ping"
|
|
16182
16500
|
};
|
|
@@ -16837,7 +17155,7 @@ var make26 = /* @__PURE__ */ fnUntraced2(function* (group, options) {
|
|
|
16837
17155
|
yield* run(clientId, (message) => {
|
|
16838
17156
|
switch (message._tag) {
|
|
16839
17157
|
case "Chunk": {
|
|
16840
|
-
const requestId =
|
|
17158
|
+
const requestId = RequestId2(message.requestId);
|
|
16841
17159
|
const entry = entries.get(requestId);
|
|
16842
17160
|
if (!entry || isNone2(entry.schemas.decodeChunk))
|
|
16843
17161
|
return void_3;
|
|
@@ -16855,7 +17173,7 @@ var make26 = /* @__PURE__ */ fnUntraced2(function* (group, options) {
|
|
|
16855
17173
|
}).pipe(andThen2(hasInterrupts2(cause) ? void_3 : ignore2(interruptRequest(requestId))))), catchCauseIf2((cause) => !hasInterrupts2(cause), () => void_3)));
|
|
16856
17174
|
}
|
|
16857
17175
|
case "Exit": {
|
|
16858
|
-
const requestId =
|
|
17176
|
+
const requestId = RequestId2(message.requestId);
|
|
16859
17177
|
const entry = entries.get(requestId);
|
|
16860
17178
|
if (!entry)
|
|
16861
17179
|
return void_3;
|
|
@@ -17235,27 +17553,6 @@ var Service2 = () => (id, options) => {
|
|
|
17235
17553
|
ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
|
|
17236
17554
|
return ServiceClass;
|
|
17237
17555
|
};
|
|
17238
|
-
// ../../protocol/package.json
|
|
17239
|
-
var package_default = {
|
|
17240
|
-
name: "@vibest/protocol",
|
|
17241
|
-
version: "0.0.1-beta.19",
|
|
17242
|
-
private: true,
|
|
17243
|
-
license: "MIT",
|
|
17244
|
-
type: "module",
|
|
17245
|
-
exports: {
|
|
17246
|
-
"./scripts/*": "./scripts/*.ts",
|
|
17247
|
-
"./*": "./src/*.ts"
|
|
17248
|
-
},
|
|
17249
|
-
scripts: {
|
|
17250
|
-
typecheck: "tsrs --noEmit --fast && tsrs --noEmit --fast -p tsconfig.scripts.json",
|
|
17251
|
-
contract: "bun scripts/contract.ts"
|
|
17252
|
-
},
|
|
17253
|
-
dependencies: {
|
|
17254
|
-
"@vibest/schema": "workspace:*",
|
|
17255
|
-
effect: "catalog:"
|
|
17256
|
-
}
|
|
17257
|
-
};
|
|
17258
|
-
|
|
17259
17556
|
// ../../protocol/src/rpc.ts
|
|
17260
17557
|
var DaemonIdentity = Struct({
|
|
17261
17558
|
pid: optional2(Number5),
|
|
@@ -17293,7 +17590,7 @@ var PingResult = Struct({
|
|
|
17293
17590
|
...DaemonIdentity.fields,
|
|
17294
17591
|
capabilities: optional2(Record(String4, Boolean3))
|
|
17295
17592
|
});
|
|
17296
|
-
|
|
17593
|
+
|
|
17297
17594
|
class ProtocolRejected extends TaggedError3()("ProtocolRejected", {
|
|
17298
17595
|
method: String4,
|
|
17299
17596
|
protocol: NullOr(String4),
|
|
@@ -17321,11 +17618,6 @@ class Forbidden2 extends TaggedError3()("Forbidden", {
|
|
|
17321
17618
|
}) {
|
|
17322
17619
|
}
|
|
17323
17620
|
|
|
17324
|
-
class ProjectCreateFailed extends TaggedError3()("ProjectCreateFailed", {
|
|
17325
|
-
message: String4
|
|
17326
|
-
}) {
|
|
17327
|
-
}
|
|
17328
|
-
|
|
17329
17621
|
class Caller extends Service()("vibest/Caller") {
|
|
17330
17622
|
}
|
|
17331
17623
|
|
|
@@ -17373,7 +17665,8 @@ var GitInfo = Struct({
|
|
|
17373
17665
|
branch: String4,
|
|
17374
17666
|
pushed: Boolean3,
|
|
17375
17667
|
saved: Boolean3,
|
|
17376
|
-
why: String4
|
|
17668
|
+
why: String4,
|
|
17669
|
+
unknown: optional2(String4)
|
|
17377
17670
|
});
|
|
17378
17671
|
var SessionInfo = Struct({
|
|
17379
17672
|
id: String4,
|
|
@@ -17385,7 +17678,7 @@ var SessionInfo = Struct({
|
|
|
17385
17678
|
status: AgentStatus,
|
|
17386
17679
|
startedAt: NullOr(Number5),
|
|
17387
17680
|
exitedAt: NullOr(Number5),
|
|
17388
|
-
|
|
17681
|
+
executionState: ExecutionState,
|
|
17389
17682
|
projectId: String4,
|
|
17390
17683
|
runtime: String4,
|
|
17391
17684
|
address: RuntimeAddress,
|
|
@@ -17405,21 +17698,17 @@ var SessionInfo = Struct({
|
|
|
17405
17698
|
view: optional2(String4)
|
|
17406
17699
|
});
|
|
17407
17700
|
var LINE_ERRORS = [UnknownMachine, MachineUnavailable, MachineIncompatible];
|
|
17408
|
-
var
|
|
17409
|
-
|
|
17410
|
-
|
|
17411
|
-
|
|
17412
|
-
|
|
17413
|
-
|
|
17414
|
-
default: Boolean3
|
|
17701
|
+
var SessionReply = Struct({
|
|
17702
|
+
execution: Number5,
|
|
17703
|
+
status: String4,
|
|
17704
|
+
text: NullOr(String4),
|
|
17705
|
+
failure: NullOr(String4),
|
|
17706
|
+
endedAt: Number5
|
|
17415
17707
|
});
|
|
17416
|
-
var
|
|
17417
|
-
|
|
17418
|
-
|
|
17419
|
-
problem: NullOr(String4),
|
|
17420
|
-
models: ArraySchema(HarnessModel)
|
|
17708
|
+
var SessionStatusInfo = Struct({
|
|
17709
|
+
...SessionInfo.fields,
|
|
17710
|
+
reply: optional2(NullOr(SessionReply))
|
|
17421
17711
|
});
|
|
17422
|
-
var ProjectActivity = Literals(["blocked", "done", "working", "idle"]);
|
|
17423
17712
|
var ProjectRow = Struct({
|
|
17424
17713
|
id: String4,
|
|
17425
17714
|
directory: NullOr(String4),
|
|
@@ -17429,7 +17718,7 @@ var ProjectRow = Struct({
|
|
|
17429
17718
|
var WatchSession = Struct({
|
|
17430
17719
|
...SessionInfo.fields,
|
|
17431
17720
|
parentId: NullOr(String4),
|
|
17432
|
-
|
|
17721
|
+
finished: NullOr(Number5)
|
|
17433
17722
|
});
|
|
17434
17723
|
var WatchEvent = Union2([
|
|
17435
17724
|
TaggedStruct("Snapshot", { projects: ArraySchema(ProjectRow), sessions: ArraySchema(WatchSession) }),
|
|
@@ -17437,9 +17726,17 @@ var WatchEvent = Union2([
|
|
|
17437
17726
|
TaggedStruct("Session", { session: WatchSession }),
|
|
17438
17727
|
TaggedStruct("SessionEnded", { id: String4, projectId: String4 })
|
|
17439
17728
|
]);
|
|
17729
|
+
var EventsFact = Struct({
|
|
17730
|
+
aggregate: String4,
|
|
17731
|
+
seq: Number5,
|
|
17732
|
+
at: Number5,
|
|
17733
|
+
type: String4,
|
|
17734
|
+
data: Unknown2
|
|
17735
|
+
});
|
|
17440
17736
|
|
|
17441
17737
|
class WatchLagged extends TaggedError3()("WatchLagged", { message: String4 }) {
|
|
17442
17738
|
}
|
|
17739
|
+
var Attachments = optional2(ArraySchema(Struct({ name: String4, content: Uint8ArrayFromBase64 })));
|
|
17443
17740
|
|
|
17444
17741
|
class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4(admitted(make25("Spawn", {
|
|
17445
17742
|
payload: {
|
|
@@ -17449,14 +17746,15 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17449
17746
|
provider: optional2(String4),
|
|
17450
17747
|
model: optional2(String4),
|
|
17451
17748
|
env: optional2(Record(String4, String4)),
|
|
17452
|
-
agent:
|
|
17749
|
+
agent: String4,
|
|
17453
17750
|
callerEnv: Record(String4, String4),
|
|
17454
17751
|
runtimeSession: optional2(String4),
|
|
17455
|
-
|
|
17752
|
+
share: optional2(String4),
|
|
17456
17753
|
archive: optional2(Boolean3),
|
|
17457
17754
|
runtime: optional2(String4),
|
|
17458
17755
|
request: optional2(String4),
|
|
17459
|
-
machine: optional2(String4)
|
|
17756
|
+
machine: optional2(String4),
|
|
17757
|
+
files: Attachments
|
|
17460
17758
|
},
|
|
17461
17759
|
success: Struct({
|
|
17462
17760
|
id: String4,
|
|
@@ -17480,20 +17778,23 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17480
17778
|
AllocationFailed,
|
|
17481
17779
|
HarnessUnavailable,
|
|
17482
17780
|
NotInRepository,
|
|
17483
|
-
|
|
17781
|
+
NoCallingSession,
|
|
17484
17782
|
NoHarnessChosen,
|
|
17485
17783
|
NoRuntime,
|
|
17486
17784
|
AgentRefused,
|
|
17785
|
+
PluginsNotActive,
|
|
17786
|
+
UnknownAgent,
|
|
17487
17787
|
NoSuchSession,
|
|
17488
17788
|
AmbiguousSession,
|
|
17489
17789
|
RuntimeUnreachable,
|
|
17490
17790
|
RuntimeIncompatible
|
|
17491
17791
|
])
|
|
17492
17792
|
}))), protocol(make25("Plugins", { success: ArraySchema(PluginInfo) })), protocol(make25("Harnesses.List", {
|
|
17493
|
-
payload: { provider: optional2(String4) },
|
|
17494
|
-
success: ArraySchema(HarnessChoice)
|
|
17793
|
+
payload: { provider: optional2(String4), machine: optional2(String4) },
|
|
17794
|
+
success: ArraySchema(HarnessChoice),
|
|
17795
|
+
error: Union2([Forbidden2, ...LINE_ERRORS])
|
|
17495
17796
|
})), scoped4(make25("Integration.Guard", {
|
|
17496
|
-
payload: { harness: String4,
|
|
17797
|
+
payload: { harness: String4, input: String4 },
|
|
17497
17798
|
success: Struct({ answer: optional2(Unknown2) }),
|
|
17498
17799
|
error: Union2([HarnessUnavailable, InvalidCaller])
|
|
17499
17800
|
})), protocol(make25("Runtimes.Doctor", {
|
|
@@ -17502,6 +17803,7 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17502
17803
|
})), protocol(make25("Subscriptions", { success: ArraySchema(Subscription) })), protocol(make25("Republish", { success: Number5 })), scoped4(admitted(make25("Launch", {
|
|
17503
17804
|
payload: {
|
|
17504
17805
|
argv: ArraySchema(String4),
|
|
17806
|
+
agent: String4,
|
|
17505
17807
|
focus: Boolean3,
|
|
17506
17808
|
callerEnv: Record(String4, String4),
|
|
17507
17809
|
runtimeSession: optional2(String4),
|
|
@@ -17518,13 +17820,14 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17518
17820
|
InvalidCaller,
|
|
17519
17821
|
Forbidden2,
|
|
17520
17822
|
NotInRepository,
|
|
17521
|
-
ProjectMoved,
|
|
17522
17823
|
LaunchFailed,
|
|
17523
17824
|
NoRuntime,
|
|
17524
|
-
AgentRefused
|
|
17825
|
+
AgentRefused,
|
|
17826
|
+
PluginsNotActive,
|
|
17827
|
+
UnknownAgent
|
|
17525
17828
|
])
|
|
17526
17829
|
}))), scoped4(admitted(make25("Send", {
|
|
17527
|
-
payload: { id: String4, message: String4, request: optional2(
|
|
17830
|
+
payload: { id: String4, message: String4, request: optional2(RequestId) },
|
|
17528
17831
|
success: Struct({ id: String4 }),
|
|
17529
17832
|
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession, ...LINE_ERRORS])
|
|
17530
17833
|
}))), scoped4(admitted(make25("Interrupt", {
|
|
@@ -17567,16 +17870,34 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17567
17870
|
view: optional2(String4)
|
|
17568
17871
|
}),
|
|
17569
17872
|
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession, NoRuntime, RuntimeUnreachable, ...LINE_ERRORS])
|
|
17570
|
-
})), scoped4(
|
|
17571
|
-
|
|
17873
|
+
})), scoped4(make25("Inbox.Subscribe", { success: Null2, error: Union2([Forbidden2]), stream: true })), scoped4(make25("Inbox.Take", {
|
|
17874
|
+
success: NullOr(Struct({
|
|
17875
|
+
execution: Number5,
|
|
17876
|
+
ids: ArraySchema(Number5),
|
|
17877
|
+
line: String4,
|
|
17878
|
+
text: String4
|
|
17879
|
+
})),
|
|
17880
|
+
error: Union2([Forbidden2])
|
|
17881
|
+
})), scoped4(make25("Events", {
|
|
17882
|
+
payload: {
|
|
17883
|
+
session: optional2(String4),
|
|
17884
|
+
after: optional2(Int.check(isGreaterThanOrEqualTo2(0))),
|
|
17885
|
+
follow: optional2(Boolean3)
|
|
17886
|
+
},
|
|
17887
|
+
success: EventsFact,
|
|
17888
|
+
error: Union2([Forbidden2, NoSuchSession]),
|
|
17889
|
+
stream: true
|
|
17890
|
+
})), scoped4(make25("Watch", { success: WatchEvent, error: Union2([Forbidden2, WatchLagged]), stream: true })), scoped4(admitted(make25("Session.Seen", {
|
|
17891
|
+
payload: { id: String4, finished: Number5 },
|
|
17572
17892
|
error: Union2([Forbidden2, NoSuchSession, RuntimeUnreachable])
|
|
17573
|
-
}))), protocol(admitted(make25("
|
|
17893
|
+
}))), protocol(admitted(make25("ExecutionEnd", {
|
|
17574
17894
|
payload: { sessionId: String4, harness: String4, event: String4 }
|
|
17575
17895
|
}))), protocol(admitted(make25("Prompt", {
|
|
17576
17896
|
payload: { sessionId: String4, harness: String4, event: String4 }
|
|
17577
|
-
}))), scoped4(admitted(make25("Project.
|
|
17897
|
+
}))), scoped4(admitted(make25("Project.EntrySession", {
|
|
17578
17898
|
payload: {
|
|
17579
17899
|
harness: String4,
|
|
17900
|
+
agent: String4,
|
|
17580
17901
|
fresh: Boolean3,
|
|
17581
17902
|
terminal: String4,
|
|
17582
17903
|
runtime: optional2(String4),
|
|
@@ -17600,15 +17921,16 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17600
17921
|
InvalidCaller,
|
|
17601
17922
|
Forbidden2,
|
|
17602
17923
|
NotInRepository,
|
|
17603
|
-
ProjectMoved,
|
|
17604
17924
|
RuntimeUnreachable,
|
|
17605
17925
|
RuntimeIncompatible,
|
|
17606
17926
|
HarnessUnavailable,
|
|
17607
|
-
LaunchFailed
|
|
17927
|
+
LaunchFailed,
|
|
17928
|
+
UnknownAgent
|
|
17608
17929
|
])
|
|
17609
|
-
}))), scoped4(make25("Project.
|
|
17930
|
+
}))), scoped4(make25("Project.StartEntry", {
|
|
17610
17931
|
payload: {
|
|
17611
17932
|
harness: optional2(String4),
|
|
17933
|
+
agent: String4,
|
|
17612
17934
|
provider: optional2(String4),
|
|
17613
17935
|
model: optional2(String4),
|
|
17614
17936
|
runtime: optional2(String4)
|
|
@@ -17624,27 +17946,29 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17624
17946
|
InvalidCaller,
|
|
17625
17947
|
Forbidden2,
|
|
17626
17948
|
NotInRepository,
|
|
17627
|
-
ProjectMoved,
|
|
17628
17949
|
NoHarnessChosen,
|
|
17629
17950
|
AgentRefused,
|
|
17951
|
+
PluginsNotActive,
|
|
17630
17952
|
HarnessUnavailable,
|
|
17631
17953
|
NoRuntime,
|
|
17632
|
-
LaunchFailed
|
|
17954
|
+
LaunchFailed,
|
|
17955
|
+
UnknownAgent
|
|
17633
17956
|
])
|
|
17634
17957
|
})), scoped4(make25("Project.Open", {
|
|
17635
|
-
payload: {
|
|
17958
|
+
payload: {},
|
|
17959
|
+
success: Struct({ projectId: String4, directory: String4 }),
|
|
17960
|
+
error: Union2([Forbidden2, NotInRepository])
|
|
17961
|
+
})), scoped4(make25("Project.Move", {
|
|
17962
|
+
payload: { from: String4 },
|
|
17636
17963
|
success: Struct({
|
|
17637
17964
|
projectId: String4,
|
|
17638
17965
|
directory: String4,
|
|
17639
|
-
|
|
17640
|
-
|
|
17641
|
-
|
|
17642
|
-
manual: ArraySchema(String4)
|
|
17643
|
-
})),
|
|
17644
|
-
candidates: optional2(ArraySchema(String4))
|
|
17966
|
+
from: String4,
|
|
17967
|
+
repaired: ArraySchema(String4),
|
|
17968
|
+
manual: ArraySchema(String4)
|
|
17645
17969
|
}),
|
|
17646
|
-
error: Union2([Forbidden2, NotInRepository,
|
|
17647
|
-
})), scoped4(make25("Project.
|
|
17970
|
+
error: Union2([Forbidden2, NotInRepository, MoveRefused])
|
|
17971
|
+
})), scoped4(make25("Project.EntryPlace", {
|
|
17648
17972
|
payload: {
|
|
17649
17973
|
callerEnv: Record(String4, String4),
|
|
17650
17974
|
runtime: optional2(String4)
|
|
@@ -17663,12 +17987,12 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17663
17987
|
})
|
|
17664
17988
|
])
|
|
17665
17989
|
}),
|
|
17666
|
-
error: Union2([InvalidCaller, Forbidden2, NotInRepository,
|
|
17667
|
-
})), scoped4(make25("Project.
|
|
17990
|
+
error: Union2([InvalidCaller, Forbidden2, NotInRepository, LaunchFailed])
|
|
17991
|
+
})), scoped4(make25("Project.FocusEntry", {
|
|
17668
17992
|
payload: {},
|
|
17669
17993
|
success: NullOr(Struct({ place: String4, focused: Boolean3 })),
|
|
17670
|
-
error: Union2([Forbidden2, NotInRepository
|
|
17671
|
-
})), scoped4(make25("Project.
|
|
17994
|
+
error: Union2([Forbidden2, NotInRepository])
|
|
17995
|
+
})), scoped4(make25("Project.RunningEntry", {
|
|
17672
17996
|
payload: { terminal: String4 },
|
|
17673
17997
|
success: NullOr(Struct({
|
|
17674
17998
|
harness: String4,
|
|
@@ -17676,30 +18000,21 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17676
18000
|
runtime: String4,
|
|
17677
18001
|
address: String4
|
|
17678
18002
|
})),
|
|
17679
|
-
error: Union2([
|
|
17680
|
-
|
|
17681
|
-
Forbidden2,
|
|
17682
|
-
NotInRepository,
|
|
17683
|
-
ProjectMoved,
|
|
17684
|
-
RuntimeUnreachable,
|
|
17685
|
-
RuntimeIncompatible
|
|
17686
|
-
])
|
|
17687
|
-
})), scoped4(admitted(make25("Project.StopCoordinator", {
|
|
18003
|
+
error: Union2([InvalidCaller, Forbidden2, NotInRepository, RuntimeUnreachable, RuntimeIncompatible])
|
|
18004
|
+
})), scoped4(admitted(make25("Project.StopEntry", {
|
|
17688
18005
|
payload: { runtime: String4, address: String4 },
|
|
17689
18006
|
success: Struct({
|
|
17690
18007
|
result: Literals(["stopped", "running", "moved", "unsupported"]),
|
|
17691
18008
|
reason: optional2(String4)
|
|
17692
18009
|
}),
|
|
17693
|
-
error: Union2([Forbidden2, NotInRepository,
|
|
17694
|
-
}))), protocol(admitted(make25("CoordinatorSessionReady", {
|
|
17695
|
-
payload: { sessionId: String4, harness: String4, harnessSessionId: String4 }
|
|
18010
|
+
error: Union2([Forbidden2, NotInRepository, RuntimeUnreachable, NoRuntime, InvalidCaller])
|
|
17696
18011
|
}))), scoped4(make25("Project.Info", {
|
|
17697
18012
|
success: ProjectInfoResult,
|
|
17698
|
-
error: Union2([Forbidden2, NotInRepository
|
|
18013
|
+
error: Union2([Forbidden2, NotInRepository])
|
|
17699
18014
|
})), scoped4(make25("Project.Search", {
|
|
17700
18015
|
payload: ProjectSearchInput.fields,
|
|
17701
18016
|
success: ArraySchema(String4),
|
|
17702
|
-
error: Union2([Forbidden2, NotInRepository
|
|
18017
|
+
error: Union2([Forbidden2, NotInRepository])
|
|
17703
18018
|
})), scoped4(admitted(make25("Project.Create", {
|
|
17704
18019
|
payload: { directory: String4, from: ArraySchema(String4) },
|
|
17705
18020
|
success: Struct({
|
|
@@ -17723,7 +18038,12 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17723
18038
|
success: Struct({ instance: String4 }),
|
|
17724
18039
|
error: Union2([Forbidden2, WrongInstance, DaemonBusy, DaemonStopping, LaunchFailed])
|
|
17725
18040
|
})), scoped4(make25("Session.Ready", {
|
|
17726
|
-
payload: {
|
|
18041
|
+
payload: {
|
|
18042
|
+
id: String4,
|
|
18043
|
+
pid: optional2(Number5),
|
|
18044
|
+
conversation: optional2(Struct({ harness: String4, id: String4 }))
|
|
18045
|
+
},
|
|
18046
|
+
success: Struct({ process: optional2(Number5) }),
|
|
17727
18047
|
error: Union2([Forbidden2, NoSuchSession])
|
|
17728
18048
|
})), scoped4(make25("Agents.Outdated", {
|
|
17729
18049
|
success: ArraySchema(Struct({
|
|
@@ -17752,15 +18072,15 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17752
18072
|
repository: String4,
|
|
17753
18073
|
identity: optional2(String4),
|
|
17754
18074
|
commit: String4,
|
|
18075
|
+
agent: String4,
|
|
17755
18076
|
prompt: String4,
|
|
17756
18077
|
harness: optional2(String4),
|
|
17757
18078
|
provider: optional2(String4),
|
|
17758
18079
|
model: optional2(String4),
|
|
17759
18080
|
title: optional2(String4),
|
|
17760
18081
|
runtime: optional2(String4),
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
request: String4
|
|
18082
|
+
request: String4,
|
|
18083
|
+
files: Attachments
|
|
17764
18084
|
},
|
|
17765
18085
|
success: Struct({
|
|
17766
18086
|
session: String4,
|
|
@@ -17779,9 +18099,12 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17779
18099
|
LimitReached,
|
|
17780
18100
|
AllocationFailed,
|
|
17781
18101
|
HarnessUnavailable,
|
|
18102
|
+
NoCallingSession,
|
|
17782
18103
|
NoHarnessChosen,
|
|
17783
18104
|
NoRuntime,
|
|
17784
18105
|
AgentRefused,
|
|
18106
|
+
PluginsNotActive,
|
|
18107
|
+
UnknownAgent,
|
|
17785
18108
|
NoSuchSession,
|
|
17786
18109
|
RuntimeUnreachable,
|
|
17787
18110
|
RuntimeIncompatible
|
|
@@ -17805,33 +18128,34 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17805
18128
|
var ACCESS = {
|
|
17806
18129
|
Ping: ["open", "peer"],
|
|
17807
18130
|
Plugins: "open",
|
|
17808
|
-
"Harnesses.List": "open",
|
|
18131
|
+
"Harnesses.List": ["open", "peer"],
|
|
17809
18132
|
"Integration.Guard": "open",
|
|
17810
18133
|
"Runtimes.Doctor": "open",
|
|
17811
18134
|
Subscriptions: "open",
|
|
17812
18135
|
Republish: "open",
|
|
17813
|
-
|
|
18136
|
+
ExecutionEnd: "open",
|
|
17814
18137
|
Prompt: "open",
|
|
17815
|
-
CoordinatorSessionReady: "open",
|
|
17816
|
-
Report: "session",
|
|
17817
18138
|
Spawn: "agent",
|
|
17818
|
-
Launch: "
|
|
18139
|
+
Launch: "cli",
|
|
17819
18140
|
List: ["agent", "peer"],
|
|
17820
18141
|
Get: ["agent", "peer"],
|
|
17821
|
-
"Inbox.Subscribe": "
|
|
18142
|
+
"Inbox.Subscribe": "session",
|
|
18143
|
+
"Inbox.Take": "session",
|
|
17822
18144
|
Watch: "cli",
|
|
18145
|
+
Events: "cli",
|
|
17823
18146
|
"Session.Seen": "cli",
|
|
17824
18147
|
"Project.Open": "cli",
|
|
17825
|
-
"Project.
|
|
17826
|
-
"Project.
|
|
17827
|
-
"Project.
|
|
17828
|
-
"Project.
|
|
17829
|
-
"Project.
|
|
17830
|
-
"Project.
|
|
18148
|
+
"Project.Move": "cli",
|
|
18149
|
+
"Project.EntryPlace": "cli",
|
|
18150
|
+
"Project.EntrySession": "cli",
|
|
18151
|
+
"Project.StartEntry": "cli",
|
|
18152
|
+
"Project.FocusEntry": "cli",
|
|
18153
|
+
"Project.RunningEntry": "agent",
|
|
18154
|
+
"Project.StopEntry": "cli",
|
|
17831
18155
|
"Project.Create": "cli",
|
|
17832
18156
|
"Project.Info": "agent",
|
|
17833
18157
|
"Project.Search": "agent",
|
|
17834
|
-
Send: ["owner", "peer"],
|
|
18158
|
+
Send: ["owner", "session", "peer"],
|
|
17835
18159
|
Interrupt: ["owner", "peer"],
|
|
17836
18160
|
Peek: ["owner", "peer"],
|
|
17837
18161
|
Remove: ["owner", "peer"],
|
|
@@ -17848,7 +18172,8 @@ var ACCESS = {
|
|
|
17848
18172
|
"Machine.List": "cli",
|
|
17849
18173
|
"Machine.Remove": "cli"
|
|
17850
18174
|
};
|
|
17851
|
-
var PEER_CALLS = new Set(Object.entries(ACCESS).filter(([, access]) => [].
|
|
18175
|
+
var PEER_CALLS = new Set(Object.entries(ACCESS).filter(([, access]) => [access].flat().includes("peer")).map(([method]) => method));
|
|
18176
|
+
var FORWARDED_CALLS = new Set([...PEER_CALLS].filter((method) => method !== "Ping" && method !== "Harnesses.List" && !method.startsWith("Peer.")));
|
|
17852
18177
|
|
|
17853
18178
|
// ../../schema/src/layout.ts
|
|
17854
18179
|
class Layout extends Service()("vibest/Layout") {
|
|
@@ -17860,6 +18185,7 @@ class Layout extends Service()("vibest/Layout") {
|
|
|
17860
18185
|
socket: path.join(home, "vibest.sock"),
|
|
17861
18186
|
httpSocket: path.join(home, "vibest-http.sock"),
|
|
17862
18187
|
daemonInfo: path.join(home, "vibestd.pid"),
|
|
18188
|
+
log: path.join(home, "vibestd.log"),
|
|
17863
18189
|
identity: path.join(home, "identity.json"),
|
|
17864
18190
|
worktrees: path.join(home, "worktrees"),
|
|
17865
18191
|
projects: path.join(home, "projects"),
|
|
@@ -17867,7 +18193,8 @@ class Layout extends Service()("vibest/Layout") {
|
|
|
17867
18193
|
plugins: path.join(home, "plugins"),
|
|
17868
18194
|
allocationWorktree: (repository, name) => path.join(home, "worktrees", repository, name),
|
|
17869
18195
|
project: (projectId) => path.join(home, "projects", projectId),
|
|
17870
|
-
artifacts: (projectId) => path.join(home, "projects", projectId, "artifacts")
|
|
18196
|
+
artifacts: (projectId) => path.join(home, "projects", projectId, "artifacts"),
|
|
18197
|
+
sessionFolder: (projectId, sessionId) => path.join(home, "projects", projectId, "sessions", sessionId)
|
|
17871
18198
|
});
|
|
17872
18199
|
});
|
|
17873
18200
|
static layer = effect(Layout, gen2(function* () {
|
|
@@ -17881,11 +18208,13 @@ var VibestCommand = Reference("vibest/VibestCommand", {
|
|
|
17881
18208
|
});
|
|
17882
18209
|
var shellQuote = (s) => /^[\w@%+=:,./-]+$/.test(s) ? s : `'${s.replace(/'/g, `'\\''`)}'`;
|
|
17883
18210
|
// ../../client/src/socket-connector.ts
|
|
17884
|
-
class
|
|
18211
|
+
class Service3 extends Service()("vibest/SocketConnector") {
|
|
17885
18212
|
}
|
|
17886
18213
|
|
|
17887
18214
|
// ../../client/src/client.ts
|
|
17888
|
-
var
|
|
18215
|
+
var SHUTDOWN_DEADLINE = seconds(10);
|
|
18216
|
+
var SHUTDOWN_FLUSH = millis(1500);
|
|
18217
|
+
var DAEMON_START_TIMEOUT = sum(sum(SHUTDOWN_DEADLINE, SHUTDOWN_FLUSH), seconds(10));
|
|
17889
18218
|
|
|
17890
18219
|
class DaemonUnavailable extends TaggedError3()("DaemonUnavailable", {
|
|
17891
18220
|
socket: String4,
|
|
@@ -17921,6 +18250,7 @@ class IncompatibleDaemon extends TaggedError3()("IncompatibleDaemon", {
|
|
|
17921
18250
|
return `${mismatch.message}. ${described(this.daemonVersion, this.daemon)} on ${this.socket} speaks ${got}; ${self} speaks protocol ${PROTOCOL}. If \`vibest daemon restart\` cannot replace it: ${byHand}. A package-version difference alone does not require a restart.`;
|
|
17922
18251
|
}
|
|
17923
18252
|
}
|
|
18253
|
+
var Claim = taggedEnum();
|
|
17924
18254
|
var protocolHeaders = () => ({ [PROTOCOL_HEADER]: String(PROTOCOL) });
|
|
17925
18255
|
var cliHeaders = (repositoryRoot) => ({
|
|
17926
18256
|
...protocolHeaders(),
|
|
@@ -17931,31 +18261,32 @@ var fromEnv2 = gen2(function* () {
|
|
|
17931
18261
|
const read = (name) => option3(String5(name)).pipe(map6((v) => getOrUndefined(v) || undefined));
|
|
17932
18262
|
return {
|
|
17933
18263
|
projectId: yield* read("VIBEST_PROJECT_ID"),
|
|
17934
|
-
agent: yield* read("VIBEST_AGENT"),
|
|
17935
18264
|
harness: yield* read("VIBEST_HARNESS"),
|
|
17936
18265
|
runtime: yield* read("VIBEST_RUNTIME"),
|
|
18266
|
+
process: yield* read("VIBEST_PROCESS"),
|
|
17937
18267
|
cwd: (yield* Path).resolve(".")
|
|
17938
18268
|
};
|
|
17939
|
-
}).pipe(tapCause2((cause) => logDebug(
|
|
17940
|
-
var claimHeaders = (claim) => claim
|
|
18269
|
+
}).pipe(tapCause2((cause) => logDebug("session claim headers fell back to the request", cause)), orElseSucceed2(() => ({})));
|
|
18270
|
+
var claimHeaders = (claim) => isTagged(claim, "cli") ? succeed7(cliHeaders(claim.repositoryRoot)) : map6(fromEnv2, (more) => sessionHeaders({
|
|
17941
18271
|
...more,
|
|
17942
18272
|
sessionId: claim.sessionId,
|
|
17943
18273
|
repositoryRoot: claim.repositoryRoot,
|
|
17944
18274
|
harnessSessionId: claim.harnessSessionId,
|
|
17945
|
-
pluginVersion: claim.pluginVersion
|
|
18275
|
+
pluginVersion: claim.pluginVersion,
|
|
18276
|
+
...claim.process !== undefined && { process: claim.process }
|
|
17946
18277
|
}));
|
|
17947
18278
|
var clientOver = (socket, options) => build(layerProtocolSocket(options).pipe(provide2(socket), provide2(layerNdJsonRpc()))).pipe(flatMap4((protocol) => make26(VibestRpcs).pipe(provide4(protocol))));
|
|
17948
|
-
var connect2 = (socket) => clientOver(effect(Socket, flatMap4(
|
|
18279
|
+
var connect2 = (socket) => clientOver(effect(Socket, flatMap4(Service3, (dial) => dial(socket))), { pingInterval: "1 minute", pingTimeout: "1 day" });
|
|
17949
18280
|
var HOOK_TIMEOUT = seconds(2);
|
|
17950
18281
|
var HOOK_RETRY_DELAY = millis(300);
|
|
17951
18282
|
var CONNECT_CODES = new Set(["ECONNREFUSED", "ENOENT"]);
|
|
17952
|
-
var notConnected = (
|
|
17953
|
-
if (!hasProperty(
|
|
18283
|
+
var notConnected = (cause) => {
|
|
18284
|
+
if (!hasProperty(cause, "reason"))
|
|
17954
18285
|
return false;
|
|
17955
|
-
if (
|
|
18286
|
+
if (!isTagged(cause.reason, "SocketOpenError") || !hasProperty(cause.reason, "cause"))
|
|
17956
18287
|
return false;
|
|
17957
|
-
const
|
|
17958
|
-
return hasProperty(
|
|
18288
|
+
const socketCause = cause.reason.cause;
|
|
18289
|
+
return hasProperty(socketCause, "code") && isString(socketCause.code) && CONNECT_CODES.has(socketCause.code);
|
|
17959
18290
|
};
|
|
17960
18291
|
var hookCall = (socket, headers, send) => {
|
|
17961
18292
|
const once = withHeaders(connect2(socket).pipe(flatMap4(send)), headers).pipe(scoped2, timeout2(HOOK_TIMEOUT), exit2);
|
|
@@ -17970,29 +18301,27 @@ var hookCall = (socket, headers, send) => {
|
|
|
17970
18301
|
var readPing = (socket) => connect2(socket).pipe(flatMap4((client) => client.Ping(undefined)), timeout2("1 second"), option2, catchCause2((cause) => hasInterruptsOnly2(cause) ? succeed7(none2()) : failCause3(cause)), scoped2);
|
|
17971
18302
|
var probe = (socket) => readPing(socket).pipe(map6(isSome2), orElseSucceed2(() => false));
|
|
17972
18303
|
var awaitDaemon = (socket) => probe(socket).pipe(repeat2({ until: (up) => up, schedule: spaced("200 millis") }), timeoutOrElse2({ duration: DAEMON_START_TIMEOUT, orElse: () => succeed7(false) }));
|
|
17973
|
-
var incompatibleDaemon = (socket, ping,
|
|
18304
|
+
var incompatibleDaemon = (socket, ping, client, needs) => {
|
|
17974
18305
|
const lacks = needs !== undefined && ping.capabilities?.[needs.capability] !== true;
|
|
17975
18306
|
return ping.protocol === PROTOCOL && !lacks ? undefined : new IncompatibleDaemon({
|
|
17976
18307
|
socket,
|
|
17977
18308
|
daemonVersion: ping.version,
|
|
17978
18309
|
daemonProtocol: ping.protocol ?? null,
|
|
17979
18310
|
daemon: { pid: ping.pid, instance: ping.instance, command: ping.command, startedAt: ping.startedAt },
|
|
17980
|
-
client
|
|
17981
|
-
...ping.protocol === PROTOCOL && needs !== undefined
|
|
18311
|
+
client,
|
|
18312
|
+
...ping.protocol === PROTOCOL && needs !== undefined && { missing: needs.method }
|
|
17982
18313
|
});
|
|
17983
18314
|
};
|
|
17984
18315
|
var spawnDaemon = (command, args = [], env) => gen2(function* () {
|
|
17985
18316
|
const layout = yield* Layout;
|
|
17986
|
-
const path = yield* Path;
|
|
17987
18317
|
const spawner = yield* ChildProcessSpawner;
|
|
17988
|
-
const log = path.join(layout.home, "vibestd.log");
|
|
17989
18318
|
yield* gen2(function* () {
|
|
17990
18319
|
const handle = yield* spawner.spawn(make13("sh", [
|
|
17991
18320
|
"-c",
|
|
17992
18321
|
'mkdir -p "$1" && log=$2 && shift 2 && { "$@" >>"$log" 2>&1 & }',
|
|
17993
18322
|
"sh",
|
|
17994
18323
|
layout.home,
|
|
17995
|
-
log,
|
|
18324
|
+
layout.log,
|
|
17996
18325
|
...command,
|
|
17997
18326
|
"daemon",
|
|
17998
18327
|
"--foreground",
|
|
@@ -18015,23 +18344,22 @@ var spawnDaemon = (command, args = [], env) => gen2(function* () {
|
|
|
18015
18344
|
});
|
|
18016
18345
|
var startDaemon = gen2(function* () {
|
|
18017
18346
|
const layout = yield* Layout;
|
|
18018
|
-
const path = yield* Path;
|
|
18019
18347
|
const fs = yield* FileSystem;
|
|
18020
|
-
const
|
|
18021
|
-
const logAt = yield* fs.stat(log).pipe(map6((info) => Number(info.size)), orElseSucceed2(() => 0));
|
|
18348
|
+
const logAt = yield* fs.stat(layout.log).pipe(map6((info) => Number(info.size)), orElseSucceed2(() => 0));
|
|
18022
18349
|
yield* spawnDaemon(yield* VibestCommand);
|
|
18023
18350
|
if (yield* awaitDaemon(layout.socket))
|
|
18024
18351
|
return;
|
|
18025
|
-
const bytes = yield* fs.readFile(log).pipe(orElseSucceed2(() => new Uint8Array));
|
|
18026
|
-
const
|
|
18352
|
+
const bytes = yield* fs.readFile(layout.log).pipe(orElseSucceed2(() => new Uint8Array));
|
|
18353
|
+
const from = bytes.length < logAt ? 0 : logAt;
|
|
18354
|
+
const text = Array.from(bytes.subarray(from), (b) => String.fromCharCode(b)).join("");
|
|
18027
18355
|
const tagged = text.split(`
|
|
18028
18356
|
`).map((line) => /^([A-Z][A-Za-z0-9]*): (.+)$/.exec(line.trim())).filter((m) => m !== null).at(-1);
|
|
18029
18357
|
return yield* new DaemonUnavailable({
|
|
18030
18358
|
socket: layout.socket,
|
|
18031
|
-
message: tagged ? `${tagged[1]}: ${tagged[2]}` : `vibestd did not come up; see ${log}`
|
|
18359
|
+
message: tagged ? `${tagged[1]}: ${tagged[2]}` : `vibestd did not come up; see ${layout.log}`
|
|
18032
18360
|
});
|
|
18033
18361
|
});
|
|
18034
|
-
var withVibest = (claim, f, options) => gen2(function* () {
|
|
18362
|
+
var withVibest = (version) => (claim, f, options) => gen2(function* () {
|
|
18035
18363
|
const layout = yield* Layout;
|
|
18036
18364
|
const up = yield* readPing(layout.socket);
|
|
18037
18365
|
if (isNone2(up)) {
|
|
@@ -18048,22 +18376,33 @@ var withVibest = (claim, f, options) => gen2(function* () {
|
|
|
18048
18376
|
socket: layout.socket,
|
|
18049
18377
|
message: `vibestd did not answer Ping on ${layout.socket}`
|
|
18050
18378
|
});
|
|
18051
|
-
const incompatible = incompatibleDaemon(layout.socket, ping, yield* VibestCommand, options?.needs);
|
|
18379
|
+
const incompatible = incompatibleDaemon(layout.socket, ping, { version, command: yield* VibestCommand }, options?.needs);
|
|
18052
18380
|
if (incompatible)
|
|
18053
18381
|
return yield* incompatible;
|
|
18054
18382
|
return yield* withHeaders(connect2(layout.socket).pipe(flatMap4((client) => f(client, ping))), yield* claimHeaders(claim));
|
|
18055
18383
|
}).pipe(scoped2);
|
|
18384
|
+
var makeClient = (options) => ({ withVibest: withVibest(options.version) });
|
|
18056
18385
|
|
|
18057
18386
|
// src/pi.ts
|
|
18387
|
+
var registrars = (api) => ({
|
|
18388
|
+
session_start: (handler) => api.on("session_start", handler),
|
|
18389
|
+
resources_discover: (handler) => api.on("resources_discover", handler),
|
|
18390
|
+
before_agent_start: (handler) => api.on("before_agent_start", handler),
|
|
18391
|
+
input: (handler) => api.on("input", handler),
|
|
18392
|
+
tool_call: (handler) => api.on("tool_call", handler),
|
|
18393
|
+
message_start: (handler) => api.on("message_start", handler),
|
|
18394
|
+
agent_end: (handler) => api.on("agent_end", handler),
|
|
18395
|
+
agent_settled: (handler) => api.on("agent_settled", handler)
|
|
18396
|
+
});
|
|
18397
|
+
|
|
18058
18398
|
class Pi extends Service()("@vibest/pi/Pi") {
|
|
18059
18399
|
static layer = (api) => succeed6(Pi, Pi.of({
|
|
18060
18400
|
handle: (event, f) => gen2(function* () {
|
|
18061
18401
|
const run = yield* makeRuntimePromise();
|
|
18062
|
-
const on = api
|
|
18063
|
-
yield* acquireRelease2(sync2(() => on(
|
|
18402
|
+
const on = registrars(api)[event];
|
|
18403
|
+
yield* acquireRelease2(sync2(() => on((e, ctx) => run(f(e, ctx)))), (off) => sync2(off));
|
|
18064
18404
|
}),
|
|
18065
|
-
sendMessage: (...args) => sync2(() => api.sendMessage(...args))
|
|
18066
|
-
load: (factory) => sync2(() => factory(api))
|
|
18405
|
+
sendMessage: (...args) => sync2(() => api.sendMessage(...args))
|
|
18067
18406
|
}));
|
|
18068
18407
|
static runMain = (api, extension) => runPromise2(gen2(function* () {
|
|
18069
18408
|
const scope = yield* make6();
|
|
@@ -18072,856 +18411,29 @@ class Pi extends Service()("@vibest/pi/Pi") {
|
|
|
18072
18411
|
}));
|
|
18073
18412
|
}
|
|
18074
18413
|
|
|
18075
|
-
// src/
|
|
18076
|
-
|
|
18077
|
-
function tool_groups_default(pi) {
|
|
18078
|
-
let open = null;
|
|
18079
|
-
let runActive = false;
|
|
18080
|
-
const groups = [];
|
|
18081
|
-
const byId = new Map;
|
|
18082
|
-
const calls = new Map;
|
|
18083
|
-
const invalidators = new Map;
|
|
18084
|
-
const expandedById = new Map;
|
|
18085
|
-
let bodyGroup = new WeakMap;
|
|
18086
|
-
let replaying = false;
|
|
18087
|
-
function gutter(width, outputPad) {
|
|
18088
|
-
const room = Math.max(1, Math.floor(width) || 1);
|
|
18089
|
-
let pad = Math.max(0, Math.floor(Number(outputPad) || 0));
|
|
18090
|
-
if (pad * 2 >= room)
|
|
18091
|
-
pad = Math.max(0, Math.floor((room - 1) / 2));
|
|
18092
|
-
return { pad, limit: Math.max(1, room - pad * 2) };
|
|
18093
|
-
}
|
|
18094
|
-
function indent(lines, pad) {
|
|
18095
|
-
if (!pad)
|
|
18096
|
-
return lines;
|
|
18097
|
-
const prefix = " ".repeat(pad);
|
|
18098
|
-
return lines.map((line) => prefix + line);
|
|
18099
|
-
}
|
|
18100
|
-
function frameLines(renderers, component, width, outputPad) {
|
|
18101
|
-
if (renderers?.renderShell === "self")
|
|
18102
|
-
return component.render(width);
|
|
18103
|
-
const { pad, limit } = gutter(width, outputPad);
|
|
18104
|
-
return indent(component.render(limit), pad);
|
|
18105
|
-
}
|
|
18106
|
-
function frameComponent(renderers, component, outputPad) {
|
|
18107
|
-
if (renderers?.renderShell === "self")
|
|
18108
|
-
return component;
|
|
18109
|
-
return {
|
|
18110
|
-
invalidate() {
|
|
18111
|
-
component.invalidate?.();
|
|
18112
|
-
},
|
|
18113
|
-
render(width) {
|
|
18114
|
-
return frameLines(renderers, component, width, outputPad);
|
|
18115
|
-
}
|
|
18116
|
-
};
|
|
18117
|
-
}
|
|
18118
|
-
function wrapText(text, width) {
|
|
18119
|
-
return wrapTextWithAnsi(String(text ?? ""), Math.max(1, width || 1));
|
|
18120
|
-
}
|
|
18121
|
-
function oneLine(text, limit) {
|
|
18122
|
-
const flat = String(text ?? "").replace(/\s+/g, " ").trim();
|
|
18123
|
-
if (!flat)
|
|
18124
|
-
return "";
|
|
18125
|
-
if (flat.length <= limit)
|
|
18126
|
-
return flat;
|
|
18127
|
-
return flat.slice(0, Math.max(1, limit - 1)) + "…";
|
|
18128
|
-
}
|
|
18129
|
-
function primaryArg(name, args) {
|
|
18130
|
-
if (args === undefined || args === null)
|
|
18131
|
-
return "";
|
|
18132
|
-
if (typeof args !== "object" || Array.isArray(args))
|
|
18133
|
-
return oneLine(typeof args === "string" ? args : JSON.stringify(args), 40);
|
|
18134
|
-
const preferred = {
|
|
18135
|
-
read: ["path", "file_path"],
|
|
18136
|
-
write: ["path", "file_path"],
|
|
18137
|
-
edit: ["path", "file_path"],
|
|
18138
|
-
ls: ["path"],
|
|
18139
|
-
bash: ["command"],
|
|
18140
|
-
powershell: ["command"],
|
|
18141
|
-
grep: ["pattern"],
|
|
18142
|
-
find: ["pattern", "path"],
|
|
18143
|
-
tool_search: ["query"]
|
|
18144
|
-
}[name] || ["path", "file_path", "command", "query", "pattern", "url"];
|
|
18145
|
-
const sensitive = /token|secret|password|authorization|credential|api[_-]?key/i;
|
|
18146
|
-
for (const key of preferred) {
|
|
18147
|
-
if (sensitive.test(key))
|
|
18148
|
-
continue;
|
|
18149
|
-
const value = args[key];
|
|
18150
|
-
if (typeof value === "string" && value)
|
|
18151
|
-
return oneLine(value, 40);
|
|
18152
|
-
}
|
|
18153
|
-
for (const [key, value] of Object.entries(args)) {
|
|
18154
|
-
if (sensitive.test(key) || key === "script" || key === "content" || key === "edits")
|
|
18155
|
-
continue;
|
|
18156
|
-
if (typeof value === "string" && value)
|
|
18157
|
-
return oneLine(value, 40);
|
|
18158
|
-
}
|
|
18159
|
-
return "";
|
|
18160
|
-
}
|
|
18161
|
-
function resultText(result) {
|
|
18162
|
-
const texts = [];
|
|
18163
|
-
if (Array.isArray(result?.content)) {
|
|
18164
|
-
for (const part of result.content)
|
|
18165
|
-
if (part?.type === "text" && part.text)
|
|
18166
|
-
texts.push(part.text);
|
|
18167
|
-
}
|
|
18168
|
-
const line = texts.join(`
|
|
18169
|
-
`).split(`
|
|
18170
|
-
`).find((item) => item.trim()) ?? "";
|
|
18171
|
-
return line.trim();
|
|
18172
|
-
}
|
|
18173
|
-
function compactText(member, limit) {
|
|
18174
|
-
const extra = calls.get(member.id);
|
|
18175
|
-
const name = member.name || extra?.name || member.id;
|
|
18176
|
-
const arg = primaryArg(name, member.args ?? extra?.args);
|
|
18177
|
-
const isError = member.isError || extra?.isError;
|
|
18178
|
-
const text = resultText(member.result ?? extra?.result);
|
|
18179
|
-
const summary = isError ? text ? "Error · " + oneLine(text, 40) : "Error" : oneLine(text, 40);
|
|
18180
|
-
let line = arg ? name + " " + arg : name;
|
|
18181
|
-
if (summary)
|
|
18182
|
-
line += " · " + summary;
|
|
18183
|
-
return wrapTextWithAnsi(line, limit);
|
|
18184
|
-
}
|
|
18185
|
-
function nestedLines(parentId, limit) {
|
|
18186
|
-
const lines = [];
|
|
18187
|
-
for (const call of calls.values()) {
|
|
18188
|
-
if (call.parentId !== parentId || byId.has(call.id))
|
|
18189
|
-
continue;
|
|
18190
|
-
lines.push(...compactText(call, limit));
|
|
18191
|
-
}
|
|
18192
|
-
return lines;
|
|
18193
|
-
}
|
|
18194
|
-
function showNative(ctx, group) {
|
|
18195
|
-
if (ctx?.expanded !== true || !group)
|
|
18196
|
-
return false;
|
|
18197
|
-
if (group.members.length < 2)
|
|
18198
|
-
return true;
|
|
18199
|
-
if (group.members[0]?.id !== ctx.toolCallId)
|
|
18200
|
-
return true;
|
|
18201
|
-
return group.members.every((member) => expandedById.get(member.id) === true);
|
|
18202
|
-
}
|
|
18203
|
-
function plainCall(name, args, width) {
|
|
18204
|
-
const lines = wrapText(name, width);
|
|
18205
|
-
if (args && typeof args === "object" && !Array.isArray(args)) {
|
|
18206
|
-
for (const [key, value] of Object.entries(args)) {
|
|
18207
|
-
const shown = typeof value === "string" ? value : JSON.stringify(value);
|
|
18208
|
-
lines.push(...wrapText(key + ": " + shown, width));
|
|
18209
|
-
}
|
|
18210
|
-
} else if (args !== undefined) {
|
|
18211
|
-
lines.push(...wrapText(JSON.stringify(args), width));
|
|
18212
|
-
}
|
|
18213
|
-
return lines;
|
|
18214
|
-
}
|
|
18215
|
-
function plainResult(result, isError, width) {
|
|
18216
|
-
const texts = [];
|
|
18217
|
-
if (Array.isArray(result?.content)) {
|
|
18218
|
-
for (const part of result.content)
|
|
18219
|
-
if (part?.type === "text" && part.text)
|
|
18220
|
-
texts.push(part.text);
|
|
18221
|
-
}
|
|
18222
|
-
const lines = [];
|
|
18223
|
-
if (isError)
|
|
18224
|
-
lines.push(...wrapText("Error", width));
|
|
18225
|
-
lines.push(...wrapText(texts.join(`
|
|
18226
|
-
`), width));
|
|
18227
|
-
return lines.filter((line) => line !== "");
|
|
18228
|
-
}
|
|
18229
|
-
function reset() {
|
|
18230
|
-
open = null;
|
|
18231
|
-
groups.length = 0;
|
|
18232
|
-
byId.clear();
|
|
18233
|
-
calls.clear();
|
|
18234
|
-
expandedById.clear();
|
|
18235
|
-
bodyGroup = new WeakMap;
|
|
18236
|
-
}
|
|
18237
|
-
function finish(group) {
|
|
18238
|
-
if (!group || group.settled)
|
|
18239
|
-
return;
|
|
18240
|
-
group.settled = true;
|
|
18241
|
-
for (const member of group.members)
|
|
18242
|
-
member.isPartial = false;
|
|
18243
|
-
ping(group.members[0]?.id);
|
|
18244
|
-
}
|
|
18245
|
-
function newGroup() {
|
|
18246
|
-
open = { settled: false, expanded: false, members: [] };
|
|
18247
|
-
groups.push(open);
|
|
18248
|
-
return open;
|
|
18249
|
-
}
|
|
18250
|
-
function place(id, name, group, args) {
|
|
18251
|
-
const current = byId.get(id);
|
|
18252
|
-
if (current === group) {
|
|
18253
|
-
const row = group.members.find((item) => item.id === id);
|
|
18254
|
-
if (row && name)
|
|
18255
|
-
row.name = name;
|
|
18256
|
-
if (row && args !== undefined)
|
|
18257
|
-
row.args = args;
|
|
18258
|
-
return group;
|
|
18259
|
-
}
|
|
18260
|
-
if (current) {
|
|
18261
|
-
const oldAnchor = current.members[0];
|
|
18262
|
-
current.members = current.members.filter((item) => item.id !== id);
|
|
18263
|
-
if (oldAnchor && oldAnchor.id !== id)
|
|
18264
|
-
ping(oldAnchor.id);
|
|
18265
|
-
}
|
|
18266
|
-
const row = { id, name: name || id, isError: false, isPartial: false, args };
|
|
18267
|
-
group.members.push(row);
|
|
18268
|
-
byId.set(id, group);
|
|
18269
|
-
const anchor = group.members[0];
|
|
18270
|
-
if (anchor !== row)
|
|
18271
|
-
ping(anchor.id);
|
|
18272
|
-
return group;
|
|
18273
|
-
}
|
|
18274
|
-
function ping(id) {
|
|
18275
|
-
if (!replaying && id)
|
|
18276
|
-
invalidators.get(id)?.();
|
|
18277
|
-
}
|
|
18278
|
-
function note(message) {
|
|
18279
|
-
if (!message || typeof message !== "object")
|
|
18280
|
-
return;
|
|
18281
|
-
if (message.role === "user" || message.role === "custom" && message.display) {
|
|
18282
|
-
finish(open);
|
|
18283
|
-
open = null;
|
|
18284
|
-
return;
|
|
18285
|
-
}
|
|
18286
|
-
if (message.role === "toolResult") {
|
|
18287
|
-
const nested = message.nestedCalls?.calls;
|
|
18288
|
-
if (!Array.isArray(nested))
|
|
18289
|
-
return;
|
|
18290
|
-
for (const call of nested) {
|
|
18291
|
-
if (!call?.id || calls.has(call.id))
|
|
18292
|
-
continue;
|
|
18293
|
-
remember(call.id, {
|
|
18294
|
-
name: call.name,
|
|
18295
|
-
args: call.arguments,
|
|
18296
|
-
parentId: message.toolCallId,
|
|
18297
|
-
isError: call.status === "error",
|
|
18298
|
-
isPartial: call.status === "unfinished"
|
|
18299
|
-
});
|
|
18300
|
-
}
|
|
18301
|
-
return;
|
|
18302
|
-
}
|
|
18303
|
-
if (message.role !== "assistant" || !Array.isArray(message.content))
|
|
18304
|
-
return;
|
|
18305
|
-
const toolCalls = message.content.filter((part) => part?.type === "toolCall" && part.id);
|
|
18306
|
-
const hasBody = message.content.some((part) => part?.type === "text" && String(part.text ?? "").trim());
|
|
18307
|
-
if (!hasBody) {
|
|
18308
|
-
for (const call of toolCalls)
|
|
18309
|
-
if (!byId.has(call.id))
|
|
18310
|
-
place(call.id, call.name, open ?? newGroup(), call.arguments);
|
|
18311
|
-
return;
|
|
18312
|
-
}
|
|
18313
|
-
let group = bodyGroup.get(message);
|
|
18314
|
-
if (!group) {
|
|
18315
|
-
if (open)
|
|
18316
|
-
finish(open);
|
|
18317
|
-
group = newGroup();
|
|
18318
|
-
bodyGroup.set(message, group);
|
|
18319
|
-
}
|
|
18320
|
-
for (const call of toolCalls)
|
|
18321
|
-
place(call.id, call.name, group, call.arguments);
|
|
18322
|
-
}
|
|
18323
|
-
function remember(id, fields) {
|
|
18324
|
-
let row = calls.get(id);
|
|
18325
|
-
if (!row) {
|
|
18326
|
-
row = { id, name: "", isError: false, isPartial: false };
|
|
18327
|
-
calls.set(id, row);
|
|
18328
|
-
}
|
|
18329
|
-
if (fields.name)
|
|
18330
|
-
row.name = fields.name;
|
|
18331
|
-
if (fields.args !== undefined)
|
|
18332
|
-
row.args = fields.args;
|
|
18333
|
-
if (fields.parentId)
|
|
18334
|
-
row.parentId = fields.parentId;
|
|
18335
|
-
if (fields.isError !== undefined)
|
|
18336
|
-
row.isError = fields.isError;
|
|
18337
|
-
if (fields.isPartial !== undefined)
|
|
18338
|
-
row.isPartial = fields.isPartial;
|
|
18339
|
-
if (fields.result !== undefined)
|
|
18340
|
-
row.result = fields.result;
|
|
18341
|
-
const owner = byId.get(row.parentId || id);
|
|
18342
|
-
ping(owner?.members[0]?.id);
|
|
18343
|
-
return row;
|
|
18344
|
-
}
|
|
18345
|
-
function pathPart(verb, one, many, ops) {
|
|
18346
|
-
if (!ops.length)
|
|
18347
|
-
return;
|
|
18348
|
-
const paths = [];
|
|
18349
|
-
for (const op of ops) {
|
|
18350
|
-
const path = op.args && typeof op.args === "object" ? op.args.path ?? op.args.file_path : undefined;
|
|
18351
|
-
if (typeof path !== "string" || !path)
|
|
18352
|
-
return verb + " " + ops.length;
|
|
18353
|
-
paths.push(path);
|
|
18354
|
-
}
|
|
18355
|
-
const count = new Set(paths).size;
|
|
18356
|
-
return verb + " " + count + " " + (count === 1 ? one : many);
|
|
18357
|
-
}
|
|
18358
|
-
function times(n, one, many) {
|
|
18359
|
-
return "Ran " + n + " " + (n === 1 ? one : many);
|
|
18360
|
-
}
|
|
18361
|
-
function summarize(group) {
|
|
18362
|
-
const seen = new Map;
|
|
18363
|
-
for (const member of group.members) {
|
|
18364
|
-
const extra = calls.get(member.id);
|
|
18365
|
-
seen.set(member.id, {
|
|
18366
|
-
name: member.name || extra?.name,
|
|
18367
|
-
args: member.args ?? extra?.args,
|
|
18368
|
-
isError: member.isError || extra?.isError,
|
|
18369
|
-
isPartial: member.isPartial || extra?.isPartial
|
|
18370
|
-
});
|
|
18371
|
-
}
|
|
18372
|
-
for (const call of calls.values()) {
|
|
18373
|
-
if (!call.parentId || !seen.has(call.parentId) || seen.has(call.id))
|
|
18374
|
-
continue;
|
|
18375
|
-
seen.set(call.id, call);
|
|
18376
|
-
}
|
|
18377
|
-
const all = [...seen.values()];
|
|
18378
|
-
const named = (name) => all.filter((item) => item.name === name);
|
|
18379
|
-
const parts = [];
|
|
18380
|
-
const code = named("codemode");
|
|
18381
|
-
if (code.length)
|
|
18382
|
-
parts.push("Ran " + code.length + " codemode");
|
|
18383
|
-
const read = pathPart("Read", "file", "files", named("read"));
|
|
18384
|
-
if (read)
|
|
18385
|
-
parts.push(read);
|
|
18386
|
-
const write = pathPart("Wrote", "file", "files", named("write"));
|
|
18387
|
-
if (write)
|
|
18388
|
-
parts.push(write);
|
|
18389
|
-
const edit = pathPart("Edited", "file", "files", named("edit"));
|
|
18390
|
-
if (edit)
|
|
18391
|
-
parts.push(edit);
|
|
18392
|
-
const shell = named("bash").length + named("powershell").length;
|
|
18393
|
-
if (shell)
|
|
18394
|
-
parts.push(times(shell, "shell command", "shell commands"));
|
|
18395
|
-
const grep = named("grep").length;
|
|
18396
|
-
if (grep)
|
|
18397
|
-
parts.push(times(grep, "content search", "content searches"));
|
|
18398
|
-
const find = named("find").length;
|
|
18399
|
-
if (find)
|
|
18400
|
-
parts.push(times(find, "file search", "file searches"));
|
|
18401
|
-
const listed = pathPart("Listed", "directory", "directories", named("ls"));
|
|
18402
|
-
if (listed)
|
|
18403
|
-
parts.push(listed);
|
|
18404
|
-
const search = named("tool_search").length;
|
|
18405
|
-
if (search)
|
|
18406
|
-
parts.push(times(search, "tool search", "tool searches"));
|
|
18407
|
-
const known = new Set([
|
|
18408
|
-
"codemode",
|
|
18409
|
-
"read",
|
|
18410
|
-
"write",
|
|
18411
|
-
"edit",
|
|
18412
|
-
"bash",
|
|
18413
|
-
"powershell",
|
|
18414
|
-
"grep",
|
|
18415
|
-
"find",
|
|
18416
|
-
"ls",
|
|
18417
|
-
"tool_search"
|
|
18418
|
-
]);
|
|
18419
|
-
const other = all.filter((item) => item.name && !known.has(item.name)).length;
|
|
18420
|
-
if (other)
|
|
18421
|
-
parts.push(times(other, "other tool call", "other tool calls"));
|
|
18422
|
-
const failed = all.filter((item) => item.isError).length;
|
|
18423
|
-
if (failed)
|
|
18424
|
-
parts.push(failed + " failed");
|
|
18425
|
-
return parts.length ? parts : [group.members.length + " tools"];
|
|
18426
|
-
}
|
|
18427
|
-
function callPath(args) {
|
|
18428
|
-
const path = args && typeof args === "object" ? args.path ?? args.file_path : undefined;
|
|
18429
|
-
return typeof path === "string" && path ? path : undefined;
|
|
18430
|
-
}
|
|
18431
|
-
function activity(call) {
|
|
18432
|
-
const path = callPath(call.args);
|
|
18433
|
-
if (call.name === "read")
|
|
18434
|
-
return path ? "Reading " + path + "…" : "Reading…";
|
|
18435
|
-
if (call.name === "write")
|
|
18436
|
-
return path ? "Writing " + path + "…" : "Writing…";
|
|
18437
|
-
if (call.name === "edit")
|
|
18438
|
-
return path ? "Editing " + path + "…" : "Editing…";
|
|
18439
|
-
if (call.name === "ls")
|
|
18440
|
-
return path ? "Listing " + path + "…" : "Listing…";
|
|
18441
|
-
if (call.name)
|
|
18442
|
-
return "Running " + call.name + "…";
|
|
18443
|
-
return "Working…";
|
|
18444
|
-
}
|
|
18445
|
-
function belongs(call, memberIds) {
|
|
18446
|
-
let current = call;
|
|
18447
|
-
const seen = new Set;
|
|
18448
|
-
while (current && !seen.has(current.id)) {
|
|
18449
|
-
if (memberIds.has(current.id))
|
|
18450
|
-
return true;
|
|
18451
|
-
seen.add(current.id);
|
|
18452
|
-
current = current.parentId ? calls.get(current.parentId) : undefined;
|
|
18453
|
-
}
|
|
18454
|
-
return false;
|
|
18455
|
-
}
|
|
18456
|
-
function header(group) {
|
|
18457
|
-
if (!runActive || group.settled)
|
|
18458
|
-
return summarize(group);
|
|
18459
|
-
const memberIds = new Set(group.members.map((member) => member.id));
|
|
18460
|
-
const partial = [];
|
|
18461
|
-
for (const member of group.members) {
|
|
18462
|
-
const extra = calls.get(member.id);
|
|
18463
|
-
if (member.isPartial || extra?.isPartial)
|
|
18464
|
-
partial.push(Object.assign({ id: member.id }, member, extra || {}));
|
|
18465
|
-
}
|
|
18466
|
-
for (const call of calls.values()) {
|
|
18467
|
-
if (!call.isPartial || partial.some((item) => item.id === call.id))
|
|
18468
|
-
continue;
|
|
18469
|
-
if (belongs(call, memberIds))
|
|
18470
|
-
partial.push(call);
|
|
18471
|
-
}
|
|
18472
|
-
const covered = new Set;
|
|
18473
|
-
for (const call of partial) {
|
|
18474
|
-
let parent = call.parentId;
|
|
18475
|
-
while (parent) {
|
|
18476
|
-
covered.add(parent);
|
|
18477
|
-
parent = calls.get(parent)?.parentId;
|
|
18478
|
-
}
|
|
18479
|
-
}
|
|
18480
|
-
const parts = partial.filter((call) => !covered.has(call.id)).map(activity);
|
|
18481
|
-
if (!parts.length)
|
|
18482
|
-
parts.push("Working…");
|
|
18483
|
-
const failed = summarize(group).filter((part) => part.endsWith(" failed"));
|
|
18484
|
-
return parts.concat(failed);
|
|
18485
|
-
}
|
|
18486
|
-
function fit(parts, width) {
|
|
18487
|
-
const limit = Math.max(1, width || 1);
|
|
18488
|
-
const lines = [];
|
|
18489
|
-
let line = "";
|
|
18490
|
-
for (const part of parts) {
|
|
18491
|
-
const piece = truncateToWidth(part, limit, "");
|
|
18492
|
-
const next = line ? line + " · " + piece : piece;
|
|
18493
|
-
if (line && visibleWidth(next) > limit) {
|
|
18494
|
-
lines.push(line);
|
|
18495
|
-
line = piece;
|
|
18496
|
-
} else {
|
|
18497
|
-
line = next;
|
|
18498
|
-
}
|
|
18499
|
-
}
|
|
18500
|
-
if (line)
|
|
18501
|
-
lines.push(line);
|
|
18502
|
-
return lines;
|
|
18503
|
-
}
|
|
18504
|
-
function visibleEntries(ctx) {
|
|
18505
|
-
const build = ctx?.sessionManager?.buildContextEntries;
|
|
18506
|
-
if (typeof build !== "function")
|
|
18507
|
-
return;
|
|
18508
|
-
const entries = build.call(ctx.sessionManager);
|
|
18509
|
-
return Array.isArray(entries) ? entries : undefined;
|
|
18510
|
-
}
|
|
18511
|
-
function replay(ctx) {
|
|
18512
|
-
const entries = visibleEntries(ctx);
|
|
18513
|
-
if (!entries)
|
|
18514
|
-
return;
|
|
18515
|
-
replaying = true;
|
|
18516
|
-
reset();
|
|
18517
|
-
for (const entry of entries) {
|
|
18518
|
-
if (entry?.type === "message")
|
|
18519
|
-
note(entry.message);
|
|
18520
|
-
else if (entry?.type === "custom_message")
|
|
18521
|
-
note({ role: "custom", display: entry.display });
|
|
18522
|
-
}
|
|
18523
|
-
replaying = false;
|
|
18524
|
-
for (const id of invalidators.keys())
|
|
18525
|
-
if (!byId.has(id))
|
|
18526
|
-
invalidators.delete(id);
|
|
18527
|
-
for (const invalidate of invalidators.values())
|
|
18528
|
-
invalidate();
|
|
18529
|
-
}
|
|
18530
|
-
function stopRun() {
|
|
18531
|
-
runActive = false;
|
|
18532
|
-
for (const call of calls.values())
|
|
18533
|
-
call.isPartial = false;
|
|
18534
|
-
for (const group of groups)
|
|
18535
|
-
for (const member of group.members)
|
|
18536
|
-
member.isPartial = false;
|
|
18537
|
-
finish(open);
|
|
18538
|
-
for (const invalidate of invalidators.values())
|
|
18539
|
-
invalidate();
|
|
18540
|
-
}
|
|
18541
|
-
let unwatch = null;
|
|
18542
|
-
function watch(manager) {
|
|
18543
|
-
unwatch?.();
|
|
18544
|
-
unwatch = null;
|
|
18545
|
-
const original = manager?.appendCustomMessageEntry;
|
|
18546
|
-
if (typeof original !== "function")
|
|
18547
|
-
return;
|
|
18548
|
-
const own = Object.getOwnPropertyDescriptor(manager, "appendCustomMessageEntry");
|
|
18549
|
-
let active = true;
|
|
18550
|
-
const wrapper = function(...args) {
|
|
18551
|
-
const id = original.apply(this, args);
|
|
18552
|
-
if (active)
|
|
18553
|
-
note({ role: "custom", display: args[2] });
|
|
18554
|
-
return id;
|
|
18555
|
-
};
|
|
18556
|
-
try {
|
|
18557
|
-
manager.appendCustomMessageEntry = wrapper;
|
|
18558
|
-
} catch {
|
|
18559
|
-
return;
|
|
18560
|
-
}
|
|
18561
|
-
unwatch = () => {
|
|
18562
|
-
active = false;
|
|
18563
|
-
if (manager.appendCustomMessageEntry !== wrapper)
|
|
18564
|
-
return;
|
|
18565
|
-
if (own)
|
|
18566
|
-
Object.defineProperty(manager, "appendCustomMessageEntry", own);
|
|
18567
|
-
else
|
|
18568
|
-
delete manager.appendCustomMessageEntry;
|
|
18569
|
-
};
|
|
18570
|
-
}
|
|
18571
|
-
pi.on("session_start", (_event, ctx) => {
|
|
18572
|
-
runActive = false;
|
|
18573
|
-
watch(ctx?.sessionManager);
|
|
18574
|
-
replay(ctx);
|
|
18575
|
-
});
|
|
18576
|
-
pi.on("session_shutdown", () => {
|
|
18577
|
-
unwatch?.();
|
|
18578
|
-
unwatch = null;
|
|
18579
|
-
});
|
|
18580
|
-
pi.on("session_compact", (_event, ctx) => replay(ctx));
|
|
18581
|
-
pi.on("session_tree", (_event, ctx) => replay(ctx));
|
|
18582
|
-
pi.on("agent_start", () => {
|
|
18583
|
-
runActive = true;
|
|
18584
|
-
});
|
|
18585
|
-
pi.on("agent_end", () => stopRun());
|
|
18586
|
-
pi.on("message_start", (event) => note(event?.message));
|
|
18587
|
-
pi.on("message_update", (event) => note(event?.message));
|
|
18588
|
-
pi.on("tool_execution_start", (event) => {
|
|
18589
|
-
if (!event?.toolCallId)
|
|
18590
|
-
return;
|
|
18591
|
-
runActive = true;
|
|
18592
|
-
remember(event.toolCallId, {
|
|
18593
|
-
name: event.toolName,
|
|
18594
|
-
args: event.args,
|
|
18595
|
-
parentId: event.parentToolCallId,
|
|
18596
|
-
isPartial: true
|
|
18597
|
-
});
|
|
18598
|
-
});
|
|
18599
|
-
pi.on("tool_execution_end", (event) => {
|
|
18600
|
-
if (!event?.toolCallId)
|
|
18601
|
-
return;
|
|
18602
|
-
remember(event.toolCallId, {
|
|
18603
|
-
name: event.toolName,
|
|
18604
|
-
args: event.args,
|
|
18605
|
-
parentId: event.parentToolCallId,
|
|
18606
|
-
isError: event.isError === true,
|
|
18607
|
-
isPartial: false,
|
|
18608
|
-
result: event.result
|
|
18609
|
-
});
|
|
18610
|
-
});
|
|
18611
|
-
pi.registerToolRenderer((toolName, next) => {
|
|
18612
|
-
const later = next();
|
|
18613
|
-
if (later?.isVibestToolGroups === true)
|
|
18614
|
-
return later;
|
|
18615
|
-
return {
|
|
18616
|
-
isVibestToolGroups: true,
|
|
18617
|
-
renderShell: "self",
|
|
18618
|
-
renderCall(args, theme, ctx) {
|
|
18619
|
-
if (ctx?.toolCallId)
|
|
18620
|
-
expandedById.set(ctx.toolCallId, ctx.expanded === true);
|
|
18621
|
-
if (ctx?.invalidate)
|
|
18622
|
-
invalidators.set(ctx.toolCallId, ctx.invalidate);
|
|
18623
|
-
let group = byId.get(ctx.toolCallId);
|
|
18624
|
-
if (!group)
|
|
18625
|
-
group = place(ctx.toolCallId, toolName, open ?? newGroup(), args);
|
|
18626
|
-
const row = group.members.find((item) => item.id === ctx.toolCallId);
|
|
18627
|
-
if (row) {
|
|
18628
|
-
row.name = toolName;
|
|
18629
|
-
if (args !== undefined)
|
|
18630
|
-
row.args = args;
|
|
18631
|
-
}
|
|
18632
|
-
const renderers = (() => {
|
|
18633
|
-
try {
|
|
18634
|
-
return next();
|
|
18635
|
-
} catch {
|
|
18636
|
-
return;
|
|
18637
|
-
}
|
|
18638
|
-
})();
|
|
18639
|
-
let native;
|
|
18640
|
-
if (renderers?.renderCall) {
|
|
18641
|
-
try {
|
|
18642
|
-
native = renderers.renderCall(args, theme, {
|
|
18643
|
-
...ctx,
|
|
18644
|
-
expanded: true,
|
|
18645
|
-
lastComponent: ctx.lastComponent?.native
|
|
18646
|
-
});
|
|
18647
|
-
} catch {
|
|
18648
|
-
native = undefined;
|
|
18649
|
-
}
|
|
18650
|
-
}
|
|
18651
|
-
const body = native ? frameComponent(renderers, native, ctx.outputPad) : {
|
|
18652
|
-
render(innerWidth) {
|
|
18653
|
-
const { pad, limit } = gutter(innerWidth, ctx.outputPad);
|
|
18654
|
-
return indent(plainCall(toolName, args, limit), pad);
|
|
18655
|
-
}
|
|
18656
|
-
};
|
|
18657
|
-
return {
|
|
18658
|
-
native,
|
|
18659
|
-
invalidate() {
|
|
18660
|
-
native?.invalidate?.();
|
|
18661
|
-
},
|
|
18662
|
-
render(width) {
|
|
18663
|
-
const current = byId.get(ctx.toolCallId);
|
|
18664
|
-
if (!current)
|
|
18665
|
-
return [];
|
|
18666
|
-
const isAnchor = current.members[0]?.id === ctx.toolCallId;
|
|
18667
|
-
if (isAnchor && ctx.expanded !== current.expanded) {
|
|
18668
|
-
current.expanded = ctx.expanded;
|
|
18669
|
-
const ids = current.members.map((member) => member.id);
|
|
18670
|
-
queueMicrotask(() => {
|
|
18671
|
-
for (const id of ids)
|
|
18672
|
-
if (id !== ctx.toolCallId)
|
|
18673
|
-
invalidators.get(id)?.();
|
|
18674
|
-
});
|
|
18675
|
-
}
|
|
18676
|
-
const { pad, limit } = gutter(width, ctx.outputPad);
|
|
18677
|
-
const paint = (line) => typeof theme?.fg === "function" ? theme.fg("muted", line) : line;
|
|
18678
|
-
const title = indent(fit(header(current), limit).map(paint), pad);
|
|
18679
|
-
if (!current.expanded)
|
|
18680
|
-
return isAnchor ? title : [];
|
|
18681
|
-
if (showNative(ctx, current))
|
|
18682
|
-
return isAnchor ? [...title, ...body.render(width)] : body.render(width);
|
|
18683
|
-
const row = current.members.find((item) => item.id === ctx.toolCallId);
|
|
18684
|
-
const lines = indent(compactText(row, limit), pad);
|
|
18685
|
-
if (isAnchor)
|
|
18686
|
-
lines.unshift(...title);
|
|
18687
|
-
lines.push(...indent(nestedLines(ctx.toolCallId, limit), pad));
|
|
18688
|
-
return lines;
|
|
18689
|
-
}
|
|
18690
|
-
};
|
|
18691
|
-
},
|
|
18692
|
-
renderResult(result, options, theme, ctx) {
|
|
18693
|
-
if (ctx?.toolCallId)
|
|
18694
|
-
expandedById.set(ctx.toolCallId, ctx.expanded === true);
|
|
18695
|
-
const group = byId.get(ctx.toolCallId) ?? place(ctx.toolCallId, toolName, open ?? newGroup());
|
|
18696
|
-
const row = group.members.find((item) => item.id === ctx.toolCallId);
|
|
18697
|
-
const changed = row.result !== result || row.isError !== ctx.isError || row.isPartial !== ctx.isPartial;
|
|
18698
|
-
row.result = result;
|
|
18699
|
-
row.isError = ctx.isError;
|
|
18700
|
-
row.isPartial = ctx.isPartial;
|
|
18701
|
-
if (row !== group.members[0] && changed)
|
|
18702
|
-
ping(group.members[0]?.id);
|
|
18703
|
-
const renderers = (() => {
|
|
18704
|
-
try {
|
|
18705
|
-
return next();
|
|
18706
|
-
} catch {
|
|
18707
|
-
return;
|
|
18708
|
-
}
|
|
18709
|
-
})();
|
|
18710
|
-
let native;
|
|
18711
|
-
if (renderers?.renderResult) {
|
|
18712
|
-
try {
|
|
18713
|
-
native = renderers.renderResult(result, { ...options, expanded: true }, theme, {
|
|
18714
|
-
...ctx,
|
|
18715
|
-
lastComponent: ctx.lastComponent?.native
|
|
18716
|
-
});
|
|
18717
|
-
} catch {
|
|
18718
|
-
native = undefined;
|
|
18719
|
-
}
|
|
18720
|
-
}
|
|
18721
|
-
const body = native ? frameComponent(renderers, native, ctx.outputPad) : {
|
|
18722
|
-
render(innerWidth) {
|
|
18723
|
-
const { pad, limit } = gutter(innerWidth, ctx.outputPad);
|
|
18724
|
-
return indent(plainResult(result, ctx.isError, limit), pad);
|
|
18725
|
-
}
|
|
18726
|
-
};
|
|
18727
|
-
return {
|
|
18728
|
-
native,
|
|
18729
|
-
invalidate() {
|
|
18730
|
-
native?.invalidate?.();
|
|
18731
|
-
},
|
|
18732
|
-
render(width) {
|
|
18733
|
-
const current = byId.get(ctx.toolCallId);
|
|
18734
|
-
if (!current?.expanded || !showNative(ctx, current))
|
|
18735
|
-
return [];
|
|
18736
|
-
return body.render(width);
|
|
18737
|
-
}
|
|
18738
|
-
};
|
|
18739
|
-
}
|
|
18740
|
-
};
|
|
18741
|
-
});
|
|
18742
|
-
}
|
|
18743
|
-
|
|
18744
|
-
// src/tui/user-message-padding.ts
|
|
18745
|
-
import { UserMessageComponent } from "@earendil-works/pi-coding-agent";
|
|
18746
|
-
import { TuiAltScreen } from "@earendil-works/pi-tui";
|
|
18747
|
-
function readLease(proto) {
|
|
18748
|
-
const lease = Object.getOwnPropertyDescriptor(proto, "vibestCompactUserMessagesLease")?.value;
|
|
18749
|
-
return lease?.by === compactUserMessages ? lease : undefined;
|
|
18750
|
-
}
|
|
18751
|
-
function writeLease(proto, lease) {
|
|
18752
|
-
if (lease)
|
|
18753
|
-
Object.defineProperty(proto, "vibestCompactUserMessagesLease", {
|
|
18754
|
-
value: lease,
|
|
18755
|
-
configurable: true,
|
|
18756
|
-
enumerable: false,
|
|
18757
|
-
writable: false
|
|
18758
|
-
});
|
|
18759
|
-
else
|
|
18760
|
-
delete proto.vibestCompactUserMessagesLease;
|
|
18761
|
-
}
|
|
18762
|
-
function restoreRender(child, descriptor) {
|
|
18763
|
-
if (descriptor)
|
|
18764
|
-
Object.defineProperty(child, "render", descriptor);
|
|
18765
|
-
else
|
|
18766
|
-
delete child.render;
|
|
18767
|
-
}
|
|
18768
|
-
function compact(original, width) {
|
|
18769
|
-
const ZONE_A = "\x1B]133;A\x07";
|
|
18770
|
-
const ZONE_B = "\x1B]133;B\x07";
|
|
18771
|
-
const ZONE_C = "\x1B]133;C\x07";
|
|
18772
|
-
const INVERTED = ZONE_B + ZONE_C + ZONE_A;
|
|
18773
|
-
const LEADING = ZONE_A + ZONE_B + ZONE_C;
|
|
18774
|
-
const children = this.children;
|
|
18775
|
-
const restores = [];
|
|
18776
|
-
try {
|
|
18777
|
-
if (Array.isArray(children)) {
|
|
18778
|
-
for (const child of children) {
|
|
18779
|
-
if (!child || typeof child !== "object")
|
|
18780
|
-
continue;
|
|
18781
|
-
const view = child;
|
|
18782
|
-
const paddingY = view.paddingY;
|
|
18783
|
-
if (!Number.isInteger(paddingY) || paddingY <= 0 || typeof view.render !== "function")
|
|
18784
|
-
continue;
|
|
18785
|
-
const descriptor = Object.getOwnPropertyDescriptor(view, "render");
|
|
18786
|
-
const childRender = view.render;
|
|
18787
|
-
view.render = function(innerWidth) {
|
|
18788
|
-
const lines = childRender.call(this, innerWidth);
|
|
18789
|
-
if (!Array.isArray(lines) || lines.length <= paddingY * 2)
|
|
18790
|
-
return lines;
|
|
18791
|
-
return lines.slice(paddingY, lines.length - paddingY);
|
|
18792
|
-
};
|
|
18793
|
-
restores.push(() => restoreRender(view, descriptor));
|
|
18794
|
-
}
|
|
18795
|
-
}
|
|
18796
|
-
const lines = original.call(this, width);
|
|
18797
|
-
if (!Array.isArray(lines) || lines.length !== 1 || typeof lines[0] !== "string" || !lines[0].startsWith(INVERTED))
|
|
18798
|
-
return lines;
|
|
18799
|
-
const copy = lines.slice();
|
|
18800
|
-
copy[0] = LEADING + lines[0].slice(INVERTED.length);
|
|
18801
|
-
return copy;
|
|
18802
|
-
} finally {
|
|
18803
|
-
for (let i = restores.length - 1;i >= 0; i--)
|
|
18804
|
-
restores[i]();
|
|
18805
|
-
}
|
|
18806
|
-
}
|
|
18807
|
-
function isFramePaint(paint, lease, nativePaint) {
|
|
18808
|
-
if (typeof paint !== "function")
|
|
18809
|
-
return false;
|
|
18810
|
-
if (lease?.paint === paint || nativePaint === paint)
|
|
18811
|
-
return true;
|
|
18812
|
-
return paint.toString().includes("renderLayoutFrame");
|
|
18813
|
-
}
|
|
18814
|
-
function compactUserMessages(pi) {
|
|
18815
|
-
const owner = {};
|
|
18816
|
-
let nativeRender;
|
|
18817
|
-
let nativePaint;
|
|
18818
|
-
let release = null;
|
|
18819
|
-
function install() {
|
|
18820
|
-
const message = UserMessageComponent?.prototype;
|
|
18821
|
-
const alt = TuiAltScreen?.prototype;
|
|
18822
|
-
const render = message?.render;
|
|
18823
|
-
const paint = alt?.doRender;
|
|
18824
|
-
if (!message || !alt || typeof render !== "function")
|
|
18825
|
-
return () => {};
|
|
18826
|
-
let lease = readLease(message);
|
|
18827
|
-
if (!isFramePaint(paint, lease, nativePaint))
|
|
18828
|
-
return () => {};
|
|
18829
|
-
if (lease)
|
|
18830
|
-
lease.owners.add(owner);
|
|
18831
|
-
else if ((nativeRender === undefined || render === nativeRender) && (nativePaint === undefined || paint === nativePaint)) {
|
|
18832
|
-
let framing = false;
|
|
18833
|
-
const next = {
|
|
18834
|
-
by: compactUserMessages,
|
|
18835
|
-
owners: new Set([owner]),
|
|
18836
|
-
render(width) {
|
|
18837
|
-
if (!next.active || !framing)
|
|
18838
|
-
return render.call(this, width);
|
|
18839
|
-
return compact.call(this, render, width);
|
|
18840
|
-
},
|
|
18841
|
-
paint() {
|
|
18842
|
-
if (!next.active)
|
|
18843
|
-
return paint.call(this);
|
|
18844
|
-
framing = true;
|
|
18845
|
-
try {
|
|
18846
|
-
return paint.call(this);
|
|
18847
|
-
} finally {
|
|
18848
|
-
framing = false;
|
|
18849
|
-
}
|
|
18850
|
-
},
|
|
18851
|
-
renderOriginal: render,
|
|
18852
|
-
paintOriginal: paint,
|
|
18853
|
-
active: true
|
|
18854
|
-
};
|
|
18855
|
-
writeLease(message, next);
|
|
18856
|
-
try {
|
|
18857
|
-
message.render = next.render;
|
|
18858
|
-
} catch (error) {
|
|
18859
|
-
writeLease(message, undefined);
|
|
18860
|
-
throw error;
|
|
18861
|
-
}
|
|
18862
|
-
try {
|
|
18863
|
-
alt.doRender = next.paint;
|
|
18864
|
-
} catch (error) {
|
|
18865
|
-
message.render = render;
|
|
18866
|
-
writeLease(message, undefined);
|
|
18867
|
-
throw error;
|
|
18868
|
-
}
|
|
18869
|
-
lease = next;
|
|
18870
|
-
} else
|
|
18871
|
-
return () => {};
|
|
18872
|
-
const held = lease;
|
|
18873
|
-
nativeRender = held.renderOriginal;
|
|
18874
|
-
nativePaint = held.paintOriginal;
|
|
18875
|
-
let released = false;
|
|
18876
|
-
return () => {
|
|
18877
|
-
if (released)
|
|
18878
|
-
return;
|
|
18879
|
-
released = true;
|
|
18880
|
-
held.owners.delete(owner);
|
|
18881
|
-
if (held.owners.size > 0)
|
|
18882
|
-
return;
|
|
18883
|
-
held.active = false;
|
|
18884
|
-
if (message.render === held.render)
|
|
18885
|
-
message.render = held.renderOriginal;
|
|
18886
|
-
if (alt.doRender === held.paint)
|
|
18887
|
-
alt.doRender = held.paintOriginal;
|
|
18888
|
-
if (readLease(message) === held)
|
|
18889
|
-
writeLease(message, undefined);
|
|
18890
|
-
};
|
|
18891
|
-
}
|
|
18892
|
-
pi.on("session_start", (_event, ctx) => {
|
|
18893
|
-
if (ctx?.mode !== "tui" || !ctx.hasUI) {
|
|
18894
|
-
release?.();
|
|
18895
|
-
release = null;
|
|
18896
|
-
return;
|
|
18897
|
-
}
|
|
18898
|
-
release?.();
|
|
18899
|
-
release = install();
|
|
18900
|
-
});
|
|
18901
|
-
pi.on("session_shutdown", () => {
|
|
18902
|
-
release?.();
|
|
18903
|
-
release = null;
|
|
18904
|
-
});
|
|
18905
|
-
}
|
|
18414
|
+
// src/version.ts
|
|
18415
|
+
var VERSION = "0.0.1-beta.20";
|
|
18906
18416
|
|
|
18907
18417
|
// src/extension.ts
|
|
18418
|
+
var { withVibest: withVibest2 } = makeClient({ version: VERSION });
|
|
18908
18419
|
var skillsDir = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "skills");
|
|
18909
18420
|
var encodeJson = encodeSync(fromJsonString2(Unknown2));
|
|
18910
|
-
var
|
|
18911
|
-
var
|
|
18421
|
+
var decodeRefusal = decodeUnknownOption2(String4);
|
|
18422
|
+
var decodeVibestDetails = decodeUnknownOption2(Struct({ execution: Number5 }));
|
|
18423
|
+
var guarded = (sessionId) => gen2(function* () {
|
|
18912
18424
|
const pi = yield* Pi;
|
|
18913
18425
|
const layout = yield* Layout;
|
|
18914
18426
|
yield* pi.handle("tool_call", (e, ctx) => gen2(function* () {
|
|
18915
|
-
const headers = yield* claimHeaders(
|
|
18427
|
+
const headers = yield* claimHeaders(Claim.session({ sessionId, pluginVersion: VERSION }));
|
|
18916
18428
|
const input = encodeJson({ tool_name: e.toolName, tool_input: e.input, cwd: ctx.cwd });
|
|
18917
|
-
const exit = yield* hookCall(layout.socket, headers, (client) => client["Integration.Guard"]({ harness: "pi",
|
|
18429
|
+
const exit = yield* hookCall(layout.socket, headers, (client) => client["Integration.Guard"]({ harness: "pi", input }));
|
|
18918
18430
|
if (isFailure3(exit))
|
|
18919
18431
|
return {
|
|
18920
18432
|
block: true,
|
|
18921
18433
|
reason: `vibest could not check this tool call (${pretty(exit.cause)}); it is refused.`
|
|
18922
18434
|
};
|
|
18923
|
-
const reason = exit.value.answer;
|
|
18924
|
-
return
|
|
18435
|
+
const reason = decodeRefusal(exit.value.answer);
|
|
18436
|
+
return isSome2(reason) && reason.value ? { block: true, reason: reason.value } : undefined;
|
|
18925
18437
|
}));
|
|
18926
18438
|
});
|
|
18927
18439
|
var lastReply = (messages) => {
|
|
@@ -18929,23 +18441,34 @@ var lastReply = (messages) => {
|
|
|
18929
18441
|
const text = (message?.content ?? []).flatMap((c) => c.type === "text" ? [c.text] : []).join("");
|
|
18930
18442
|
return { text, error: message?.stopReason === "error" ? message.errorMessage || "error" : "" };
|
|
18931
18443
|
};
|
|
18932
|
-
var piHeaders = (sessionId, ctx) => claimHeaders({
|
|
18933
|
-
_tag: "session",
|
|
18444
|
+
var piHeaders = (sessionId, ctx, current) => claimHeaders(Claim.session({
|
|
18934
18445
|
sessionId,
|
|
18935
18446
|
harnessSessionId: ctx.sessionManager.getSessionId(),
|
|
18936
|
-
pluginVersion: VERSION
|
|
18937
|
-
}
|
|
18938
|
-
|
|
18447
|
+
pluginVersion: VERSION,
|
|
18448
|
+
...current !== undefined && { process: current }
|
|
18449
|
+
}));
|
|
18450
|
+
var session = (sessionId, processId) => effectDiscard(gen2(function* () {
|
|
18939
18451
|
const pi = yield* Pi;
|
|
18940
18452
|
const layout = yield* Layout;
|
|
18941
18453
|
const root = yield* make24(false);
|
|
18942
18454
|
const reply = yield* make24({ text: "", error: "" });
|
|
18943
18455
|
yield* pi.handle("session_start", (_e, ctx) => set2(root, ctx.mode === "tui"));
|
|
18944
18456
|
yield* pi.handle("agent_end", (e) => set2(reply, lastReply(e.messages)));
|
|
18457
|
+
yield* pi.handle("message_start", (e, ctx) => gen2(function* () {
|
|
18458
|
+
const message = e.message;
|
|
18459
|
+
if (message.role !== "custom" || message.customType !== "vibest")
|
|
18460
|
+
return;
|
|
18461
|
+
const details = decodeVibestDetails(message.details);
|
|
18462
|
+
if (isNone2(details))
|
|
18463
|
+
return;
|
|
18464
|
+
const headers = yield* piHeaders(sessionId, ctx, yield* get2(processId));
|
|
18465
|
+
const event = encodeJson({ type: "accepted", execution: details.value.execution });
|
|
18466
|
+
yield* hookCall(layout.socket, headers, (client) => client.Prompt({ sessionId, harness: "pi", event }));
|
|
18467
|
+
}));
|
|
18945
18468
|
yield* pi.handle("input", (e, ctx) => gen2(function* () {
|
|
18946
18469
|
if (e.source === "extension" || e.text.trim() === "")
|
|
18947
18470
|
return;
|
|
18948
|
-
const headers = yield* piHeaders(sessionId, ctx);
|
|
18471
|
+
const headers = yield* piHeaders(sessionId, ctx, yield* get2(processId));
|
|
18949
18472
|
const event = encodeJson({ type: "input", text: e.text, source: e.source });
|
|
18950
18473
|
yield* hookCall(layout.socket, headers, (client) => client.Prompt({ sessionId, harness: "pi", event }));
|
|
18951
18474
|
}));
|
|
@@ -18953,9 +18476,9 @@ var session = (sessionId) => effectDiscard(gen2(function* () {
|
|
|
18953
18476
|
if (!(yield* get2(root)) || !ctx.isIdle())
|
|
18954
18477
|
return;
|
|
18955
18478
|
const { text, error } = yield* get2(reply);
|
|
18956
|
-
const headers = yield* piHeaders(sessionId, ctx);
|
|
18479
|
+
const headers = yield* piHeaders(sessionId, ctx, yield* get2(processId));
|
|
18957
18480
|
const event = encodeJson({ type: "agent_settled", text, error, aborted: e.aborted });
|
|
18958
|
-
yield* hookCall(layout.socket, headers, (client) => client.
|
|
18481
|
+
yield* hookCall(layout.socket, headers, (client) => client.ExecutionEnd({ sessionId, harness: "pi", event }));
|
|
18959
18482
|
}));
|
|
18960
18483
|
}));
|
|
18961
18484
|
var reportSession = fn2("reportSession")(function* (sessionId) {
|
|
@@ -18968,57 +18491,65 @@ var reportSession = fn2("reportSession")(function* (sessionId) {
|
|
|
18968
18491
|
if (ctx.mode !== "tui" || (yield* get2(reported)) === harnessSessionId)
|
|
18969
18492
|
return;
|
|
18970
18493
|
const headers = yield* piHeaders(sessionId, ctx);
|
|
18971
|
-
yield* connect2(layout.socket).pipe(flatMap4((client) => client.
|
|
18494
|
+
yield* connect2(layout.socket).pipe(flatMap4((client) => client["Session.Ready"]({ id: sessionId, conversation: { harness: "pi", id: harnessSessionId } }, { headers })), scoped2, timeout2("1 second"), andThen2(set2(reported, harnessSessionId)), catchCause2((cause) => hasInterruptsOnly2(cause) ? void_3 : sync2(() => ctx.ui.notify(`vibest: the entry session's conversation may not have been saved: ${pretty(cause)}`, "warning"))), forkIn2(scope));
|
|
18972
18495
|
});
|
|
18973
18496
|
yield* pi.handle("session_start", (event, ctx) => event.reason === "new" || event.reason === "resume" || event.reason === "fork" ? send(ctx) : void_3);
|
|
18974
18497
|
yield* pi.handle("agent_end", (_event, ctx) => send(ctx));
|
|
18975
18498
|
});
|
|
18976
|
-
var
|
|
18499
|
+
var terminal = (sessionId) => effectDiscard(gen2(function* () {
|
|
18977
18500
|
const pi = yield* Pi;
|
|
18978
18501
|
yield* pi.handle("resources_discover", () => succeed7({ skillPaths: [skillsDir] }));
|
|
18979
|
-
yield*
|
|
18980
|
-
|
|
18981
|
-
|
|
18982
|
-
yield*
|
|
18983
|
-
yield* pi.load(compactUserMessages);
|
|
18984
|
-
const sessionId = yield* option3(String5("VIBEST_SESSION_ID"));
|
|
18985
|
-
if (isNone2(sessionId))
|
|
18986
|
-
return;
|
|
18987
|
-
yield* reportSession(sessionId.value);
|
|
18502
|
+
yield* reportSession(sessionId);
|
|
18503
|
+
}));
|
|
18504
|
+
var inbox = (sessionId, processId) => effectDiscard(gen2(function* () {
|
|
18505
|
+
const pi = yield* Pi;
|
|
18988
18506
|
const started = yield* make5();
|
|
18989
18507
|
yield* pi.handle("session_start", (_e, ctx) => ctx.mode === "tui" ? succeed4(started, ctx).pipe(asVoid2) : void_3);
|
|
18990
|
-
const
|
|
18991
|
-
|
|
18992
|
-
sessionId: sessionId.value,
|
|
18508
|
+
const identity = (ctx) => map6(get2(processId), (current) => Claim.session({
|
|
18509
|
+
sessionId,
|
|
18993
18510
|
harnessSessionId: ctx.sessionManager.getSessionId(),
|
|
18994
|
-
pluginVersion: VERSION
|
|
18995
|
-
|
|
18996
|
-
|
|
18511
|
+
pluginVersion: VERSION,
|
|
18512
|
+
...current !== undefined && { process: current }
|
|
18513
|
+
}));
|
|
18514
|
+
const takeNext = (ctx) => gen2(function* () {
|
|
18515
|
+
if (!ctx.isIdle())
|
|
18516
|
+
return;
|
|
18517
|
+
const taken = yield* withVibest2(yield* identity(ctx), (client) => client["Inbox.Take"](undefined), {
|
|
18518
|
+
start: false
|
|
18519
|
+
});
|
|
18520
|
+
if (taken === null)
|
|
18521
|
+
return;
|
|
18522
|
+
yield* pi.sendMessage({ customType: "vibest", content: taken.text, display: false, details: { execution: taken.execution } }, { triggerTurn: true });
|
|
18523
|
+
}).pipe(ignore2);
|
|
18524
|
+
yield* pi.handle("agent_settled", (_e, ctx) => takeNext(ctx));
|
|
18525
|
+
const subscribe = (ctx) => flatMap4(identity(ctx), (who) => withVibest2(who, (client) => client["Inbox.Subscribe"](undefined).pipe(runForEach2(() => takeNext(ctx)), catchCause2((cause) => hasInterruptsOnly2(cause) ? void_3 : failCause3(cause))), { start: false })).pipe(retry2({
|
|
18526
|
+
while: (e) => isTagged(e, "RpcClientError") || isTagged(e, "DaemonUnavailable"),
|
|
18997
18527
|
schedule: spaced("2 seconds")
|
|
18998
18528
|
}), repeat2(spaced("2 seconds")));
|
|
18999
18529
|
yield* _await(started).pipe(flatMap4((ctx) => subscribe(ctx).pipe(catchCause2((cause) => hasInterruptsOnly2(cause) ? void_3 : sync2(() => ctx.ui.notify(`vibest: inbox subscription ended: ${pretty(cause)}`, "error"))))), forkScoped2);
|
|
19000
18530
|
}));
|
|
19001
|
-
var ready = (sessionId) => effectDiscard(gen2(function* () {
|
|
18531
|
+
var ready = (sessionId, processId) => effectDiscard(gen2(function* () {
|
|
19002
18532
|
const pi = yield* Pi;
|
|
19003
18533
|
const scope = yield* scope2;
|
|
19004
|
-
yield* pi.handle("session_start", (_e, ctx) => ctx.mode !== "tui" ? void_3 :
|
|
19005
|
-
|
|
18534
|
+
yield* pi.handle("session_start", (_e, ctx) => ctx.mode !== "tui" ? void_3 : get2(processId).pipe(flatMap4((current) => withVibest2(Claim.session({
|
|
18535
|
+
sessionId,
|
|
18536
|
+
pluginVersion: VERSION,
|
|
18537
|
+
...current !== undefined && { process: current }
|
|
18538
|
+
}), (client) => client["Session.Ready"]({ id: sessionId, pid: process.pid }), { start: false })), tap2((answer) => answer.process === undefined ? void_3 : set2(processId, String(answer.process))), timeout2("2 seconds"), retry2({
|
|
18539
|
+
while: (e) => isTagged(e, "DaemonUnavailable") || isTagged(e, "RpcClientError") || isTagged(e, "TimeoutError"),
|
|
19006
18540
|
schedule: spaced("1 second")
|
|
19007
18541
|
}), ignore2, forkIn2(scope), asVoid2));
|
|
19008
18542
|
}));
|
|
19009
18543
|
var extension2 = unwrap(gen2(function* () {
|
|
19010
|
-
const agent = getOrUndefined(yield* option3(String5("VIBEST_AGENT")));
|
|
19011
|
-
if (!agent)
|
|
19012
|
-
return empty4;
|
|
19013
18544
|
const sessionId = getOrUndefined(yield* option3(String5("VIBEST_SESSION_ID")));
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
return sessionId
|
|
18545
|
+
if (!sessionId)
|
|
18546
|
+
return empty4;
|
|
18547
|
+
const processId = yield* make24(getOrUndefined(yield* option3(String5("VIBEST_PROCESS"))));
|
|
18548
|
+
const guard = merge2(effectDiscard(guarded(sessionId)), ready(sessionId, processId));
|
|
18549
|
+
return terminal(sessionId).pipe(provideMerge(mergeAll2(session(sessionId, processId), inbox(sessionId, processId)).pipe(provideMerge(guard))));
|
|
19019
18550
|
}));
|
|
19020
18551
|
var vibestCommand = effect(VibestCommand, schema(fromJsonString2(ArraySchema(String4)), "VIBEST_COMMAND").pipe(withDefault3(["vibest"])));
|
|
19021
|
-
var services = mergeAll2(Layout.layer, layer.pipe(provide2(layer2)), layer2, succeed6(
|
|
18552
|
+
var services = mergeAll2(Layout.layer, layer.pipe(provide2(layer2)), layer2, succeed6(Service3, (endpoint) => makeNet({ path: endpoint })), vibestCommand).pipe(provideMerge(layer3));
|
|
19022
18553
|
var extension_default = (api) => Pi.runMain(api, extension2.pipe(provide2(services)));
|
|
19023
18554
|
export {
|
|
19024
18555
|
extension_default as default,
|