@vibest/cli 0.0.1-beta.17 → 0.0.1-beta.19
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 +0 -5
- package/harnesses/claude/.claude-plugin/plugin.json +1 -1
- package/harnesses/claude/README.md +21 -2
- package/harnesses/claude/hooks/register.mjs +7 -7
- package/harnesses/claude/skills/delegate/SKILL.md +5 -5
- package/harnesses/claude/skills/pipeline/SKILL.md +3 -3
- package/harnesses/cursor/.cursor-plugin/plugin.json +1 -1
- package/harnesses/cursor/hooks/hooks.json +13 -3
- package/harnesses/cursor/hooks/vibest.sh +3 -8
- package/harnesses/cursor/skills/delegate/SKILL.md +5 -5
- package/harnesses/cursor/skills/pipeline/SKILL.md +3 -3
- package/harnesses/pi/extension.mjs +474 -529
- package/harnesses/pi/skills/delegate/SKILL.md +5 -5
- package/harnesses/pi/skills/pipeline/SKILL.md +3 -3
- package/herdr-plugin/README.md +1 -1
- package/package.json +16 -14
|
@@ -7708,18 +7708,6 @@ var reasonAnnotations2 = reasonAnnotations;
|
|
|
7708
7708
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Clock.js
|
|
7709
7709
|
var Clock = ClockRef;
|
|
7710
7710
|
|
|
7711
|
-
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/random.js
|
|
7712
|
-
var Random = /* @__PURE__ */ Reference("effect/Random", {
|
|
7713
|
-
defaultValue: () => ({
|
|
7714
|
-
nextIntUnsafe() {
|
|
7715
|
-
return Math.floor(Math.random() * (Number.MAX_SAFE_INTEGER - Number.MIN_SAFE_INTEGER + 1)) + Number.MIN_SAFE_INTEGER;
|
|
7716
|
-
},
|
|
7717
|
-
nextDoubleUnsafe() {
|
|
7718
|
-
return Math.random();
|
|
7719
|
-
}
|
|
7720
|
-
})
|
|
7721
|
-
});
|
|
7722
|
-
|
|
7723
7711
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Pull.js
|
|
7724
7712
|
var catchDone = /* @__PURE__ */ dual(2, (effect, f) => catchCauseFilter(effect, filterDoneLeftover, (l) => f(l)));
|
|
7725
7713
|
var isDoneCause = (cause) => cause.reasons.some(isDoneFailure);
|
|
@@ -8013,6 +8001,7 @@ var runSyncExit2 = runSyncExit;
|
|
|
8013
8001
|
var fnUntraced2 = fnUntraced;
|
|
8014
8002
|
var fn2 = fn;
|
|
8015
8003
|
var logError = /* @__PURE__ */ logWithLevel("Error");
|
|
8004
|
+
var logDebug = /* @__PURE__ */ logWithLevel("Debug");
|
|
8016
8005
|
var annotateLogs = /* @__PURE__ */ dual((args) => isEffect2(args[0]), (effect, ...args) => updateService(effect, CurrentLogAnnotations2, (annotations) => {
|
|
8017
8006
|
const newAnnotations = args.length === 1 ? {
|
|
8018
8007
|
...annotations,
|
|
@@ -13862,7 +13851,26 @@ var toCodecStringTreeAST = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempote
|
|
|
13862
13851
|
});
|
|
13863
13852
|
|
|
13864
13853
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Struct.js
|
|
13854
|
+
var pick = /* @__PURE__ */ dual(2, (self, keys) => {
|
|
13855
|
+
return buildStruct(self, (k, v) => hasPropertyKey(keys, k) ? [k, v] : undefined);
|
|
13856
|
+
});
|
|
13865
13857
|
var lambda = (f) => f;
|
|
13858
|
+
function hasPropertyKey(keys, key) {
|
|
13859
|
+
return keys.some((candidate) => candidate === key || typeof candidate === "number" && String(candidate) === key);
|
|
13860
|
+
}
|
|
13861
|
+
function buildStruct(source, f) {
|
|
13862
|
+
const out = {};
|
|
13863
|
+
for (const k of Reflect.ownKeys(source)) {
|
|
13864
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, k))
|
|
13865
|
+
continue;
|
|
13866
|
+
const res = f(k, source[k]);
|
|
13867
|
+
if (res) {
|
|
13868
|
+
const [nk, nv] = res;
|
|
13869
|
+
assignProperty(out, nk, nv);
|
|
13870
|
+
}
|
|
13871
|
+
}
|
|
13872
|
+
return out;
|
|
13873
|
+
}
|
|
13866
13874
|
|
|
13867
13875
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schemaError.js
|
|
13868
13876
|
var SchemaErrorTypeId = "~effect/Schema/SchemaError";
|
|
@@ -15134,7 +15142,7 @@ var fromDuplex = (open, options) => withFiber2((fiber) => {
|
|
|
15134
15142
|
});
|
|
15135
15143
|
|
|
15136
15144
|
// ../../protocol/src/protocol.ts
|
|
15137
|
-
var PROTOCOL =
|
|
15145
|
+
var PROTOCOL = 8;
|
|
15138
15146
|
var MISMATCH_ACTION = "vibest update";
|
|
15139
15147
|
var protocolMismatch = (caller, server, version, callerVersion) => ({
|
|
15140
15148
|
protocol: server,
|
|
@@ -15174,18 +15182,6 @@ var sessionHeaders = (who) => {
|
|
|
15174
15182
|
headers[REPOSITORY_HEADER] = who.repositoryRoot;
|
|
15175
15183
|
return headers;
|
|
15176
15184
|
};
|
|
15177
|
-
|
|
15178
|
-
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Random.js
|
|
15179
|
-
var Random2 = Random;
|
|
15180
|
-
var randomWith = (f) => withFiber2((fiber) => succeed7(f(fiber.getRef(Random2))));
|
|
15181
|
-
var nextIntBetween = (min, max, options) => {
|
|
15182
|
-
const extra = options?.halfOpen === true ? 0 : 1;
|
|
15183
|
-
return randomWith((r) => {
|
|
15184
|
-
const minInt = Math.ceil(min);
|
|
15185
|
-
const maxInt = Math.floor(max);
|
|
15186
|
-
return Math.floor(r.nextDoubleUnsafe() * (maxInt - minInt + extra)) + minInt;
|
|
15187
|
-
});
|
|
15188
|
-
};
|
|
15189
15185
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/ConfigProvider.js
|
|
15190
15186
|
function makeValue(value) {
|
|
15191
15187
|
return {
|
|
@@ -15574,9 +15570,100 @@ var makeUnsafe6 = (value) => {
|
|
|
15574
15570
|
var make24 = (value) => sync2(() => makeUnsafe6(value));
|
|
15575
15571
|
var get2 = (self) => sync2(() => self.ref.current);
|
|
15576
15572
|
var set2 = /* @__PURE__ */ dual(2, (self, value) => sync2(() => set(self.ref, value)));
|
|
15577
|
-
//
|
|
15578
|
-
|
|
15579
|
-
|
|
15573
|
+
// ../../schema/src/machine.ts
|
|
15574
|
+
class MachineFailed extends TaggedError3()("MachineFailed", { message: String4 }) {
|
|
15575
|
+
}
|
|
15576
|
+
|
|
15577
|
+
class UnknownMachine extends TaggedError3()("UnknownMachine", {
|
|
15578
|
+
machine: String4,
|
|
15579
|
+
machines: ArraySchema(String4)
|
|
15580
|
+
}) {
|
|
15581
|
+
get message() {
|
|
15582
|
+
const known = this.machines.length === 0 ? "none is added (vibest machine add)" : `machines: ${this.machines.join(", ")}`;
|
|
15583
|
+
return `unknown machine ${JSON.stringify(this.machine)}; ${known}`;
|
|
15584
|
+
}
|
|
15585
|
+
}
|
|
15586
|
+
|
|
15587
|
+
class MachineUnavailable extends TaggedError3()("MachineUnavailable", {
|
|
15588
|
+
machine: String4,
|
|
15589
|
+
message: String4
|
|
15590
|
+
}) {
|
|
15591
|
+
}
|
|
15592
|
+
|
|
15593
|
+
class MachineIncompatible extends TaggedError3()("MachineIncompatible", {
|
|
15594
|
+
machine: String4,
|
|
15595
|
+
message: String4
|
|
15596
|
+
}) {
|
|
15597
|
+
}
|
|
15598
|
+
|
|
15599
|
+
class AlreadyAdded extends TaggedError3()("AlreadyAdded", {
|
|
15600
|
+
machine: String4,
|
|
15601
|
+
id: String4
|
|
15602
|
+
}) {
|
|
15603
|
+
get message() {
|
|
15604
|
+
return `this is the vibestd already added as ${this.machine} (${this.id.slice(0, 8)}); use that name`;
|
|
15605
|
+
}
|
|
15606
|
+
}
|
|
15607
|
+
var MachineState = Literals(["connecting", "connected", "unreachable", "different"]);
|
|
15608
|
+
var MachineNote = Struct({
|
|
15609
|
+
plugin: optional2(String4),
|
|
15610
|
+
message: String4,
|
|
15611
|
+
fix: optional2(String4)
|
|
15612
|
+
});
|
|
15613
|
+
var RuntimeThere = Struct({
|
|
15614
|
+
kind: String4,
|
|
15615
|
+
status: Literals(["online", "offline", "blocked"]),
|
|
15616
|
+
reason: optional2(String4),
|
|
15617
|
+
link: optional2(Record(String4, String4))
|
|
15618
|
+
});
|
|
15619
|
+
var RuntimeView = Struct({
|
|
15620
|
+
kind: String4,
|
|
15621
|
+
status: RuntimeThere.fields.status,
|
|
15622
|
+
reason: optional2(String4),
|
|
15623
|
+
here: Struct({
|
|
15624
|
+
visible: Boolean3,
|
|
15625
|
+
as: optional2(String4),
|
|
15626
|
+
note: optional2(String4)
|
|
15627
|
+
})
|
|
15628
|
+
});
|
|
15629
|
+
var MachineInfo = Struct({
|
|
15630
|
+
name: String4,
|
|
15631
|
+
target: String4,
|
|
15632
|
+
id: String4,
|
|
15633
|
+
state: MachineState,
|
|
15634
|
+
since: Number5,
|
|
15635
|
+
reason: optional2(String4),
|
|
15636
|
+
connectedAt: Number5,
|
|
15637
|
+
vibestd: optional2(String4),
|
|
15638
|
+
version: optional2(String4),
|
|
15639
|
+
runtimes: optional2(ArraySchema(RuntimeView)),
|
|
15640
|
+
runtimesAt: optional2(Number5),
|
|
15641
|
+
notes: optional2(ArraySchema(Struct({ ...MachineNote.fields, at: Number5 })))
|
|
15642
|
+
});
|
|
15643
|
+
var ListedMachine = MachineInfo.mapFields(pick(["name", "state", "since", "reason"]));
|
|
15644
|
+
|
|
15645
|
+
class NoProject extends TaggedError3()("NoProject", { message: String4 }) {
|
|
15646
|
+
}
|
|
15647
|
+
|
|
15648
|
+
class NoCommit extends TaggedError3()("NoCommit", { message: String4 }) {
|
|
15649
|
+
}
|
|
15650
|
+
var OUTBOX_ITEM_MAX = 1024 * 1024;
|
|
15651
|
+
var PROMPT_MAX = 1024 * 1024;
|
|
15652
|
+
|
|
15653
|
+
class PromptTooLarge extends TaggedError3()("PromptTooLarge", { bytes: Number5 }) {
|
|
15654
|
+
get message() {
|
|
15655
|
+
return `the prompt is ${this.bytes} bytes; another machine takes at most ${PROMPT_MAX} bytes (1 MiB)`;
|
|
15656
|
+
}
|
|
15657
|
+
}
|
|
15658
|
+
var OutboxItem = Struct({
|
|
15659
|
+
id: String4,
|
|
15660
|
+
session: String4,
|
|
15661
|
+
recipient: String4,
|
|
15662
|
+
kind: Literals(["result", "notice"]),
|
|
15663
|
+
content: String4,
|
|
15664
|
+
cut: optional2(Boolean3)
|
|
15665
|
+
});
|
|
15666
|
+
|
|
15580
15667
|
// ../../schema/src/id.ts
|
|
15581
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}$/;
|
|
15582
15669
|
|
|
@@ -15680,7 +15767,7 @@ var PluginInfo = Struct({
|
|
|
15680
15767
|
var ProjectKind = Literals(["docs", "memories", "artifacts"]);
|
|
15681
15768
|
var ProjectInfoResult = Struct({
|
|
15682
15769
|
directory: String4,
|
|
15683
|
-
|
|
15770
|
+
preferences: String4,
|
|
15684
15771
|
docs: String4,
|
|
15685
15772
|
memories: String4,
|
|
15686
15773
|
artifacts: String4
|
|
@@ -15725,7 +15812,7 @@ var InboxRow = Struct({
|
|
|
15725
15812
|
status: InboxStatus,
|
|
15726
15813
|
createdAt: Number5
|
|
15727
15814
|
});
|
|
15728
|
-
|
|
15815
|
+
|
|
15729
15816
|
class HarnessUnavailable extends TaggedError3()("HarnessUnavailable", {
|
|
15730
15817
|
harness: String4,
|
|
15731
15818
|
message: String4
|
|
@@ -15797,7 +15884,7 @@ class NotReady extends TaggedError3()("NotReady", {
|
|
|
15797
15884
|
|
|
15798
15885
|
class NoHarnessChosen extends TaggedError3()("NoHarnessChosen", {}) {
|
|
15799
15886
|
get message() {
|
|
15800
|
-
return "no harness
|
|
15887
|
+
return "no harness to inherit: name one, for example `vibest run claude -- <prompt>`";
|
|
15801
15888
|
}
|
|
15802
15889
|
}
|
|
15803
15890
|
|
|
@@ -15825,7 +15912,7 @@ var SubscriptionLimit = Struct({
|
|
|
15825
15912
|
resetTime: NullOr(Number5)
|
|
15826
15913
|
});
|
|
15827
15914
|
var Subscription = Struct({
|
|
15828
|
-
harness:
|
|
15915
|
+
harness: String4,
|
|
15829
15916
|
provider: String4,
|
|
15830
15917
|
machine: Literal2("local"),
|
|
15831
15918
|
account: SubscriptionAccount,
|
|
@@ -15855,9 +15942,9 @@ function Stream2(success, error) {
|
|
|
15855
15942
|
}
|
|
15856
15943
|
|
|
15857
15944
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/rpc/Rpc.js
|
|
15858
|
-
var
|
|
15945
|
+
var TypeId29 = "~effect/rpc/Rpc";
|
|
15859
15946
|
var Proto8 = {
|
|
15860
|
-
[
|
|
15947
|
+
[TypeId29]: TypeId29,
|
|
15861
15948
|
pipe() {
|
|
15862
15949
|
return pipeArguments(this, arguments);
|
|
15863
15950
|
},
|
|
@@ -15991,8 +16078,8 @@ var exitSchema = (self) => {
|
|
|
15991
16078
|
var WrapperTypeId = "~effect/rpc/Rpc/Wrapper";
|
|
15992
16079
|
var isWrapper = (u) => (WrapperTypeId in u);
|
|
15993
16080
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/http/HttpClientError.js
|
|
15994
|
-
var
|
|
15995
|
-
class HttpClientErrorSchema extends (/* @__PURE__ */ Error4(
|
|
16081
|
+
var TypeId30 = "~effect/http/HttpClientError";
|
|
16082
|
+
class HttpClientErrorSchema extends (/* @__PURE__ */ Error4(TypeId30)({
|
|
15996
16083
|
_tag: /* @__PURE__ */ tag("HttpError"),
|
|
15997
16084
|
kind: /* @__PURE__ */ Literals(["EncodeError", "DecodeError", "TransportError", "InvalidUrlError", "StatusCodeError", "EmptyBodyError"]),
|
|
15998
16085
|
cause: /* @__PURE__ */ optional2(/* @__PURE__ */ Defect())
|
|
@@ -16069,7 +16156,7 @@ var spanAttributes = (tag, attributes) => ({
|
|
|
16069
16156
|
});
|
|
16070
16157
|
|
|
16071
16158
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/rpc/RpcClientError.js
|
|
16072
|
-
var
|
|
16159
|
+
var TypeId31 = "~effect/rpc/RpcClientError";
|
|
16073
16160
|
|
|
16074
16161
|
class RpcClientDefect extends (/* @__PURE__ */ Error4("effect/rpc/RpcClientError/RpcClientDefect")({
|
|
16075
16162
|
_tag: /* @__PURE__ */ tag("RpcClientDefect"),
|
|
@@ -16078,11 +16165,11 @@ class RpcClientDefect extends (/* @__PURE__ */ Error4("effect/rpc/RpcClientError
|
|
|
16078
16165
|
})) {
|
|
16079
16166
|
}
|
|
16080
16167
|
|
|
16081
|
-
class RpcClientError extends (/* @__PURE__ */ Error4(
|
|
16168
|
+
class RpcClientError extends (/* @__PURE__ */ Error4(TypeId31)({
|
|
16082
16169
|
_tag: /* @__PURE__ */ tag("RpcClientError"),
|
|
16083
16170
|
reason: /* @__PURE__ */ Union2([WorkerErrorReason, SocketErrorReason, HttpClientErrorSchema, RpcClientDefect])
|
|
16084
16171
|
})) {
|
|
16085
|
-
[
|
|
16172
|
+
[TypeId31] = TypeId31;
|
|
16086
16173
|
get message() {
|
|
16087
16174
|
return `${this.reason._tag}: ${this.reason.message}`;
|
|
16088
16175
|
}
|
|
@@ -17125,7 +17212,7 @@ var make27 = (...rpcs) => makeProto2({
|
|
|
17125
17212
|
annotations: empty3()
|
|
17126
17213
|
});
|
|
17127
17214
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/rpc/RpcMiddleware.js
|
|
17128
|
-
var
|
|
17215
|
+
var TypeId32 = "~effect/rpc/RpcMiddleware";
|
|
17129
17216
|
var Service2 = () => (id, options) => {
|
|
17130
17217
|
const limit = getStackTraceLimit();
|
|
17131
17218
|
let creationError;
|
|
@@ -17143,7 +17230,7 @@ var Service2 = () => (id, options) => {
|
|
|
17143
17230
|
return creationError?.stack;
|
|
17144
17231
|
}
|
|
17145
17232
|
});
|
|
17146
|
-
ServiceClass_[
|
|
17233
|
+
ServiceClass_[TypeId32] = TypeId32;
|
|
17147
17234
|
ServiceClass_.error = options?.error ?? Never2;
|
|
17148
17235
|
ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
|
|
17149
17236
|
return ServiceClass;
|
|
@@ -17151,15 +17238,17 @@ var Service2 = () => (id, options) => {
|
|
|
17151
17238
|
// ../../protocol/package.json
|
|
17152
17239
|
var package_default = {
|
|
17153
17240
|
name: "@vibest/protocol",
|
|
17154
|
-
version: "0.0.1-beta.
|
|
17241
|
+
version: "0.0.1-beta.19",
|
|
17155
17242
|
private: true,
|
|
17156
17243
|
license: "MIT",
|
|
17157
17244
|
type: "module",
|
|
17158
17245
|
exports: {
|
|
17246
|
+
"./scripts/*": "./scripts/*.ts",
|
|
17159
17247
|
"./*": "./src/*.ts"
|
|
17160
17248
|
},
|
|
17161
17249
|
scripts: {
|
|
17162
|
-
typecheck: "tsrs --noEmit --fast"
|
|
17250
|
+
typecheck: "tsrs --noEmit --fast && tsrs --noEmit --fast -p tsconfig.scripts.json",
|
|
17251
|
+
contract: "bun scripts/contract.ts"
|
|
17163
17252
|
},
|
|
17164
17253
|
dependencies: {
|
|
17165
17254
|
"@vibest/schema": "workspace:*",
|
|
@@ -17191,10 +17280,16 @@ var RuntimeDoctor = Struct({
|
|
|
17191
17280
|
fix: optional2(String4)
|
|
17192
17281
|
}))
|
|
17193
17282
|
});
|
|
17283
|
+
var UpdateStatus = Struct({
|
|
17284
|
+
checked: NullOr(Number5),
|
|
17285
|
+
latest: NullOr(String4),
|
|
17286
|
+
checking: Boolean3
|
|
17287
|
+
});
|
|
17194
17288
|
var PingResult = Struct({
|
|
17195
17289
|
protocol: optional2(Number5),
|
|
17196
17290
|
version: String4,
|
|
17197
17291
|
runtimes: optional2(ArraySchema(RuntimeStatus)),
|
|
17292
|
+
update: optional2(UpdateStatus),
|
|
17198
17293
|
...DaemonIdentity.fields,
|
|
17199
17294
|
capabilities: optional2(Record(String4, Boolean3))
|
|
17200
17295
|
});
|
|
@@ -17226,6 +17321,11 @@ class Forbidden2 extends TaggedError3()("Forbidden", {
|
|
|
17226
17321
|
}) {
|
|
17227
17322
|
}
|
|
17228
17323
|
|
|
17324
|
+
class ProjectCreateFailed extends TaggedError3()("ProjectCreateFailed", {
|
|
17325
|
+
message: String4
|
|
17326
|
+
}) {
|
|
17327
|
+
}
|
|
17328
|
+
|
|
17229
17329
|
class Caller extends Service()("vibest/Caller") {
|
|
17230
17330
|
}
|
|
17231
17331
|
|
|
@@ -17279,7 +17379,7 @@ var SessionInfo = Struct({
|
|
|
17279
17379
|
id: String4,
|
|
17280
17380
|
name: String4,
|
|
17281
17381
|
agent: String4,
|
|
17282
|
-
harness:
|
|
17382
|
+
harness: String4,
|
|
17283
17383
|
provider: NullOr(String4),
|
|
17284
17384
|
model: NullOr(String4),
|
|
17285
17385
|
status: AgentStatus,
|
|
@@ -17300,34 +17400,82 @@ var SessionInfo = Struct({
|
|
|
17300
17400
|
status: MessageStatus,
|
|
17301
17401
|
summary: String4,
|
|
17302
17402
|
endedAt: NullOr(Number5)
|
|
17303
|
-
}))
|
|
17403
|
+
})),
|
|
17404
|
+
machine: optional2(String4),
|
|
17405
|
+
view: optional2(String4)
|
|
17304
17406
|
});
|
|
17407
|
+
var LINE_ERRORS = [UnknownMachine, MachineUnavailable, MachineIncompatible];
|
|
17305
17408
|
var InboxMessage = Struct({ ...InboxRow.fields, details: Record(String4, Unknown2) });
|
|
17306
17409
|
var SessionStatusInfo = Struct({ ...SessionInfo.fields, result: NullOr(InboxMessage) });
|
|
17410
|
+
var HarnessModel = Struct({
|
|
17411
|
+
provider: NullOr(String4),
|
|
17412
|
+
model: String4,
|
|
17413
|
+
name: String4,
|
|
17414
|
+
default: Boolean3
|
|
17415
|
+
});
|
|
17416
|
+
var HarnessChoice = Struct({
|
|
17417
|
+
harness: String4,
|
|
17418
|
+
binary: String4,
|
|
17419
|
+
problem: NullOr(String4),
|
|
17420
|
+
models: ArraySchema(HarnessModel)
|
|
17421
|
+
});
|
|
17422
|
+
var ProjectActivity = Literals(["blocked", "done", "working", "idle"]);
|
|
17423
|
+
var ProjectRow = Struct({
|
|
17424
|
+
id: String4,
|
|
17425
|
+
directory: NullOr(String4),
|
|
17426
|
+
entrySessionId: NullOr(String4),
|
|
17427
|
+
activity: ProjectActivity
|
|
17428
|
+
});
|
|
17429
|
+
var WatchSession = Struct({
|
|
17430
|
+
...SessionInfo.fields,
|
|
17431
|
+
parentId: NullOr(String4),
|
|
17432
|
+
turn: NullOr(Number5)
|
|
17433
|
+
});
|
|
17434
|
+
var WatchEvent = Union2([
|
|
17435
|
+
TaggedStruct("Snapshot", { projects: ArraySchema(ProjectRow), sessions: ArraySchema(WatchSession) }),
|
|
17436
|
+
TaggedStruct("Project", { project: ProjectRow }),
|
|
17437
|
+
TaggedStruct("Session", { session: WatchSession }),
|
|
17438
|
+
TaggedStruct("SessionEnded", { id: String4, projectId: String4 })
|
|
17439
|
+
]);
|
|
17440
|
+
|
|
17441
|
+
class WatchLagged extends TaggedError3()("WatchLagged", { message: String4 }) {
|
|
17442
|
+
}
|
|
17307
17443
|
|
|
17308
17444
|
class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4(admitted(make25("Spawn", {
|
|
17309
17445
|
payload: {
|
|
17310
17446
|
name: optional2(String4),
|
|
17311
17447
|
prompt: String4,
|
|
17312
|
-
harness: optional2(
|
|
17448
|
+
harness: optional2(String4),
|
|
17313
17449
|
provider: optional2(String4),
|
|
17314
17450
|
model: optional2(String4),
|
|
17315
17451
|
env: optional2(Record(String4, String4)),
|
|
17316
17452
|
agent: optional2(String4),
|
|
17317
|
-
|
|
17453
|
+
callerEnv: Record(String4, String4),
|
|
17454
|
+
runtimeSession: optional2(String4),
|
|
17318
17455
|
peer: optional2(String4),
|
|
17319
|
-
archive: optional2(Boolean3)
|
|
17456
|
+
archive: optional2(Boolean3),
|
|
17457
|
+
runtime: optional2(String4),
|
|
17458
|
+
request: optional2(String4),
|
|
17459
|
+
machine: optional2(String4)
|
|
17320
17460
|
},
|
|
17321
17461
|
success: Struct({
|
|
17322
17462
|
id: String4,
|
|
17323
|
-
harness:
|
|
17463
|
+
harness: String4,
|
|
17324
17464
|
provider: optional2(String4),
|
|
17325
17465
|
model: optional2(String4),
|
|
17326
|
-
...Routing.fields
|
|
17466
|
+
...Routing.fields,
|
|
17467
|
+
notes: optional2(ArraySchema(MachineNote))
|
|
17327
17468
|
}),
|
|
17328
17469
|
error: Union2([
|
|
17329
17470
|
InvalidCaller,
|
|
17330
17471
|
Forbidden2,
|
|
17472
|
+
MachineFailed,
|
|
17473
|
+
UnknownMachine,
|
|
17474
|
+
MachineUnavailable,
|
|
17475
|
+
MachineIncompatible,
|
|
17476
|
+
NoProject,
|
|
17477
|
+
NoCommit,
|
|
17478
|
+
PromptTooLarge,
|
|
17331
17479
|
LimitReached,
|
|
17332
17480
|
AllocationFailed,
|
|
17333
17481
|
HarnessUnavailable,
|
|
@@ -17341,21 +17489,30 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17341
17489
|
RuntimeUnreachable,
|
|
17342
17490
|
RuntimeIncompatible
|
|
17343
17491
|
])
|
|
17344
|
-
}))), protocol(make25("Plugins", { success: ArraySchema(PluginInfo) })), protocol(make25("
|
|
17492
|
+
}))), protocol(make25("Plugins", { success: ArraySchema(PluginInfo) })), protocol(make25("Harnesses.List", {
|
|
17493
|
+
payload: { provider: optional2(String4) },
|
|
17494
|
+
success: ArraySchema(HarnessChoice)
|
|
17495
|
+
})), scoped4(make25("Integration.Guard", {
|
|
17496
|
+
payload: { harness: String4, agent: String4, input: String4 },
|
|
17497
|
+
success: Struct({ answer: optional2(Unknown2) }),
|
|
17498
|
+
error: Union2([HarnessUnavailable, InvalidCaller])
|
|
17499
|
+
})), protocol(make25("Runtimes.Doctor", {
|
|
17345
17500
|
payload: { harnesses: ArraySchema(String4) },
|
|
17346
17501
|
success: ArraySchema(RuntimeDoctor)
|
|
17347
17502
|
})), protocol(make25("Subscriptions", { success: ArraySchema(Subscription) })), protocol(make25("Republish", { success: Number5 })), scoped4(admitted(make25("Launch", {
|
|
17348
17503
|
payload: {
|
|
17349
17504
|
argv: ArraySchema(String4),
|
|
17350
17505
|
focus: Boolean3,
|
|
17351
|
-
|
|
17506
|
+
callerEnv: Record(String4, String4),
|
|
17507
|
+
runtimeSession: optional2(String4),
|
|
17352
17508
|
runtime: optional2(String4)
|
|
17353
17509
|
},
|
|
17354
17510
|
success: Struct({
|
|
17355
17511
|
runtime: String4,
|
|
17356
17512
|
terminal: String4,
|
|
17357
17513
|
place: String4,
|
|
17358
|
-
attach: NullOr(ArraySchema(String4))
|
|
17514
|
+
attach: NullOr(ArraySchema(String4)),
|
|
17515
|
+
routing: optional2(String4)
|
|
17359
17516
|
}),
|
|
17360
17517
|
error: Union2([
|
|
17361
17518
|
InvalidCaller,
|
|
@@ -17367,51 +17524,77 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17367
17524
|
AgentRefused
|
|
17368
17525
|
])
|
|
17369
17526
|
}))), scoped4(admitted(make25("Send", {
|
|
17370
|
-
payload: { id: String4, message: String4 },
|
|
17527
|
+
payload: { id: String4, message: String4, request: optional2(String4) },
|
|
17371
17528
|
success: Struct({ id: String4 }),
|
|
17372
|
-
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession])
|
|
17529
|
+
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession, ...LINE_ERRORS])
|
|
17373
17530
|
}))), scoped4(admitted(make25("Interrupt", {
|
|
17374
17531
|
payload: { id: String4 },
|
|
17375
17532
|
success: Struct({ id: String4, message: String4 }),
|
|
17376
|
-
error: Union2([
|
|
17533
|
+
error: Union2([
|
|
17534
|
+
Forbidden2,
|
|
17535
|
+
NoSuchSession,
|
|
17536
|
+
AmbiguousSession,
|
|
17537
|
+
SessionBusy,
|
|
17538
|
+
RuntimeUnreachable,
|
|
17539
|
+
NoRuntime,
|
|
17540
|
+
...LINE_ERRORS
|
|
17541
|
+
])
|
|
17377
17542
|
}))), scoped4(admitted(make25("Remove", {
|
|
17378
17543
|
payload: { id: String4, keepWorktree: optional2(Boolean3) },
|
|
17379
17544
|
success: NullOr(RemoveOutcome),
|
|
17380
|
-
error: Union2([
|
|
17545
|
+
error: Union2([
|
|
17546
|
+
Forbidden2,
|
|
17547
|
+
NoSuchSession,
|
|
17548
|
+
AmbiguousSession,
|
|
17549
|
+
SessionBusy,
|
|
17550
|
+
RuntimeUnreachable,
|
|
17551
|
+
NoRuntime,
|
|
17552
|
+
...LINE_ERRORS
|
|
17553
|
+
])
|
|
17381
17554
|
}))), scoped4(make25("List", {
|
|
17382
17555
|
payload: { stopped: optional2(Boolean3), all: optional2(Boolean3) },
|
|
17383
|
-
success: ArraySchema(SessionInfo),
|
|
17556
|
+
success: Struct({ sessions: ArraySchema(SessionInfo), machines: ArraySchema(ListedMachine) }),
|
|
17384
17557
|
error: Union2([Forbidden2])
|
|
17385
17558
|
})), scoped4(make25("Get", {
|
|
17386
17559
|
payload: { id: String4 },
|
|
17387
17560
|
success: SessionStatusInfo,
|
|
17388
|
-
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession])
|
|
17561
|
+
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession, ...LINE_ERRORS])
|
|
17389
17562
|
})), scoped4(make25("Peek", {
|
|
17390
17563
|
payload: { id: String4, lines: optional2(Number5) },
|
|
17391
|
-
success: Struct({
|
|
17392
|
-
|
|
17393
|
-
|
|
17394
|
-
|
|
17564
|
+
success: Struct({
|
|
17565
|
+
text: String4,
|
|
17566
|
+
terminal: optional2(String4),
|
|
17567
|
+
view: optional2(String4)
|
|
17568
|
+
}),
|
|
17569
|
+
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession, NoRuntime, RuntimeUnreachable, ...LINE_ERRORS])
|
|
17570
|
+
})), scoped4(admitted(make25("Report", { payload: { message: String4 }, error: Union2([Forbidden2, NoSuchSession]) }))), scoped4(make25("Inbox.Subscribe", { success: String4, error: Union2([Forbidden2]), stream: true })), scoped4(make25("Watch", { success: WatchEvent, error: Union2([Forbidden2, WatchLagged]), stream: true })), scoped4(admitted(make25("Session.Seen", {
|
|
17571
|
+
payload: { id: String4, turn: Number5 },
|
|
17572
|
+
error: Union2([Forbidden2, NoSuchSession, RuntimeUnreachable])
|
|
17573
|
+
}))), protocol(admitted(make25("TurnEnd", {
|
|
17574
|
+
payload: { sessionId: String4, harness: String4, event: String4 }
|
|
17395
17575
|
}))), protocol(admitted(make25("Prompt", {
|
|
17396
|
-
payload: { sessionId: String4, harness:
|
|
17576
|
+
payload: { sessionId: String4, harness: String4, event: String4 }
|
|
17397
17577
|
}))), scoped4(admitted(make25("Project.CoordinatorSession", {
|
|
17398
17578
|
payload: {
|
|
17399
|
-
harness:
|
|
17579
|
+
harness: String4,
|
|
17400
17580
|
fresh: Boolean3,
|
|
17401
17581
|
terminal: String4,
|
|
17402
|
-
machine: optional2(RuntimeMachine),
|
|
17403
17582
|
runtime: optional2(String4),
|
|
17404
17583
|
provider: optional2(String4),
|
|
17405
17584
|
model: optional2(String4),
|
|
17406
17585
|
routing: optional2(Routing),
|
|
17407
|
-
pid: optional2(Number5)
|
|
17408
|
-
env: optional2(Record(String4, String4))
|
|
17586
|
+
pid: optional2(Number5)
|
|
17409
17587
|
},
|
|
17410
17588
|
success: Struct({
|
|
17411
17589
|
sessionId: String4,
|
|
17412
17590
|
harnessSessionId: NullOr(String4),
|
|
17413
17591
|
projectId: String4,
|
|
17414
|
-
runtime: optional2(String4)
|
|
17592
|
+
runtime: optional2(String4),
|
|
17593
|
+
command: Struct({
|
|
17594
|
+
file: String4,
|
|
17595
|
+
args: ArraySchema(String4),
|
|
17596
|
+
env: Record(String4, String4)
|
|
17597
|
+
})
|
|
17415
17598
|
}),
|
|
17416
17599
|
error: Union2([
|
|
17417
17600
|
InvalidCaller,
|
|
@@ -17419,17 +17602,19 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17419
17602
|
NotInRepository,
|
|
17420
17603
|
ProjectMoved,
|
|
17421
17604
|
RuntimeUnreachable,
|
|
17422
|
-
RuntimeIncompatible
|
|
17605
|
+
RuntimeIncompatible,
|
|
17606
|
+
HarnessUnavailable,
|
|
17607
|
+
LaunchFailed
|
|
17423
17608
|
])
|
|
17424
17609
|
}))), scoped4(make25("Project.StartMain", {
|
|
17425
17610
|
payload: {
|
|
17426
|
-
harness: optional2(
|
|
17611
|
+
harness: optional2(String4),
|
|
17427
17612
|
provider: optional2(String4),
|
|
17428
17613
|
model: optional2(String4),
|
|
17429
17614
|
runtime: optional2(String4)
|
|
17430
17615
|
},
|
|
17431
17616
|
success: Struct({
|
|
17432
|
-
harness:
|
|
17617
|
+
harness: String4,
|
|
17433
17618
|
provider: optional2(String4),
|
|
17434
17619
|
model: optional2(String4),
|
|
17435
17620
|
runtime: String4,
|
|
@@ -17443,7 +17628,8 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17443
17628
|
NoHarnessChosen,
|
|
17444
17629
|
AgentRefused,
|
|
17445
17630
|
HarnessUnavailable,
|
|
17446
|
-
NoRuntime
|
|
17631
|
+
NoRuntime,
|
|
17632
|
+
LaunchFailed
|
|
17447
17633
|
])
|
|
17448
17634
|
})), scoped4(make25("Project.Open", {
|
|
17449
17635
|
payload: { move: optional2(Boolean3) },
|
|
@@ -17458,10 +17644,34 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17458
17644
|
candidates: optional2(ArraySchema(String4))
|
|
17459
17645
|
}),
|
|
17460
17646
|
error: Union2([Forbidden2, NotInRepository, ProjectMoved])
|
|
17647
|
+
})), scoped4(make25("Project.MainPlace", {
|
|
17648
|
+
payload: {
|
|
17649
|
+
callerEnv: Record(String4, String4),
|
|
17650
|
+
runtime: optional2(String4)
|
|
17651
|
+
},
|
|
17652
|
+
success: Struct({
|
|
17653
|
+
directory: String4,
|
|
17654
|
+
place: Union2([
|
|
17655
|
+
Struct({
|
|
17656
|
+
in: Literals(["terminal"]),
|
|
17657
|
+
runtime: String4,
|
|
17658
|
+
terminal: String4
|
|
17659
|
+
}),
|
|
17660
|
+
Struct({
|
|
17661
|
+
in: Literals(["launch"]),
|
|
17662
|
+
runtime: String4
|
|
17663
|
+
})
|
|
17664
|
+
])
|
|
17665
|
+
}),
|
|
17666
|
+
error: Union2([InvalidCaller, Forbidden2, NotInRepository, ProjectMoved, LaunchFailed])
|
|
17667
|
+
})), scoped4(make25("Project.FocusCoordinator", {
|
|
17668
|
+
payload: {},
|
|
17669
|
+
success: NullOr(Struct({ place: String4, focused: Boolean3 })),
|
|
17670
|
+
error: Union2([Forbidden2, NotInRepository, ProjectMoved])
|
|
17461
17671
|
})), scoped4(make25("Project.RunningCoordinator", {
|
|
17462
|
-
payload: { terminal: String4
|
|
17672
|
+
payload: { terminal: String4 },
|
|
17463
17673
|
success: NullOr(Struct({
|
|
17464
|
-
harness:
|
|
17674
|
+
harness: String4,
|
|
17465
17675
|
place: String4,
|
|
17466
17676
|
runtime: String4,
|
|
17467
17677
|
address: String4
|
|
@@ -17482,7 +17692,7 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17482
17692
|
}),
|
|
17483
17693
|
error: Union2([Forbidden2, NotInRepository, ProjectMoved, RuntimeUnreachable, NoRuntime, InvalidCaller])
|
|
17484
17694
|
}))), protocol(admitted(make25("CoordinatorSessionReady", {
|
|
17485
|
-
payload: { sessionId: String4, harness:
|
|
17695
|
+
payload: { sessionId: String4, harness: String4, harnessSessionId: String4 }
|
|
17486
17696
|
}))), scoped4(make25("Project.Info", {
|
|
17487
17697
|
success: ProjectInfoResult,
|
|
17488
17698
|
error: Union2([Forbidden2, NotInRepository, ProjectMoved])
|
|
@@ -17490,7 +17700,21 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17490
17700
|
payload: ProjectSearchInput.fields,
|
|
17491
17701
|
success: ArraySchema(String4),
|
|
17492
17702
|
error: Union2([Forbidden2, NotInRepository, ProjectMoved])
|
|
17493
|
-
})), scoped4(make25("
|
|
17703
|
+
})), scoped4(admitted(make25("Project.Create", {
|
|
17704
|
+
payload: { directory: String4, from: ArraySchema(String4) },
|
|
17705
|
+
success: Struct({
|
|
17706
|
+
directory: String4,
|
|
17707
|
+
folders: ArraySchema(Struct({
|
|
17708
|
+
name: String4,
|
|
17709
|
+
source: String4,
|
|
17710
|
+
path: String4,
|
|
17711
|
+
branch: String4,
|
|
17712
|
+
origin: optional2(String4),
|
|
17713
|
+
uncommitted: ArraySchema(String4)
|
|
17714
|
+
}))
|
|
17715
|
+
}),
|
|
17716
|
+
error: Union2([Forbidden2, ProjectCreateFailed])
|
|
17717
|
+
}))), scoped4(make25("Daemon.Stop", {
|
|
17494
17718
|
payload: { instance: String4 },
|
|
17495
17719
|
success: Struct({ instance: String4 }),
|
|
17496
17720
|
error: Union2([Forbidden2, WrongInstance, DaemonBusy, DaemonStopping])
|
|
@@ -17498,18 +17722,6 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17498
17722
|
payload: { instance: String4, command: ArraySchema(String4) },
|
|
17499
17723
|
success: Struct({ instance: String4 }),
|
|
17500
17724
|
error: Union2([Forbidden2, WrongInstance, DaemonBusy, DaemonStopping, LaunchFailed])
|
|
17501
|
-
})), scoped4(make25("Session.Start", {
|
|
17502
|
-
payload: { id: String4 },
|
|
17503
|
-
success: Struct({
|
|
17504
|
-
harness: Literals(HARNESS_IDS),
|
|
17505
|
-
harnessSessionId: NullOr(String4),
|
|
17506
|
-
provider: NullOr(String4),
|
|
17507
|
-
model: NullOr(String4),
|
|
17508
|
-
projectId: String4,
|
|
17509
|
-
runtime: optional2(String4),
|
|
17510
|
-
env: optional2(Record(String4, String4))
|
|
17511
|
-
}),
|
|
17512
|
-
error: Union2([Forbidden2, NoSuchSession])
|
|
17513
17725
|
})), scoped4(make25("Session.Ready", {
|
|
17514
17726
|
payload: { id: String4, pid: optional2(Number5) },
|
|
17515
17727
|
error: Union2([Forbidden2, NoSuchSession])
|
|
@@ -17517,7 +17729,7 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17517
17729
|
success: ArraySchema(Struct({
|
|
17518
17730
|
id: String4,
|
|
17519
17731
|
agent: String4,
|
|
17520
|
-
harness:
|
|
17732
|
+
harness: String4,
|
|
17521
17733
|
integration: NullOr(String4),
|
|
17522
17734
|
working: Boolean3,
|
|
17523
17735
|
blocked: NullOr(String4)
|
|
@@ -17526,8 +17738,117 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17526
17738
|
})), scoped4(make25("Agents.Restart", {
|
|
17527
17739
|
payload: { ids: ArraySchema(String4), after: optional2(Number5) },
|
|
17528
17740
|
error: Forbidden2
|
|
17741
|
+
})), scoped4(make25("Peer.Hello", {
|
|
17742
|
+
payload: { id: String4, name: String4, callsMe: String4 },
|
|
17743
|
+
success: Struct({
|
|
17744
|
+
id: String4,
|
|
17745
|
+
name: String4,
|
|
17746
|
+
version: String4,
|
|
17747
|
+
runtimes: optional2(ArraySchema(RuntimeThere))
|
|
17748
|
+
}),
|
|
17749
|
+
error: Forbidden2
|
|
17750
|
+
})), scoped4(admitted(make25("Peer.Spawn", {
|
|
17751
|
+
payload: {
|
|
17752
|
+
repository: String4,
|
|
17753
|
+
identity: optional2(String4),
|
|
17754
|
+
commit: String4,
|
|
17755
|
+
prompt: String4,
|
|
17756
|
+
harness: optional2(String4),
|
|
17757
|
+
provider: optional2(String4),
|
|
17758
|
+
model: optional2(String4),
|
|
17759
|
+
title: optional2(String4),
|
|
17760
|
+
runtime: optional2(String4),
|
|
17761
|
+
parent: optional2(String4),
|
|
17762
|
+
reportTo: optional2(String4),
|
|
17763
|
+
request: String4
|
|
17764
|
+
},
|
|
17765
|
+
success: Struct({
|
|
17766
|
+
session: String4,
|
|
17767
|
+
harness: String4,
|
|
17768
|
+
provider: optional2(String4),
|
|
17769
|
+
model: optional2(String4),
|
|
17770
|
+
directory: String4,
|
|
17771
|
+
...Routing.fields
|
|
17772
|
+
}),
|
|
17773
|
+
error: Union2([
|
|
17774
|
+
InvalidCaller,
|
|
17775
|
+
Forbidden2,
|
|
17776
|
+
NoProject,
|
|
17777
|
+
NoCommit,
|
|
17778
|
+
PromptTooLarge,
|
|
17779
|
+
LimitReached,
|
|
17780
|
+
AllocationFailed,
|
|
17781
|
+
HarnessUnavailable,
|
|
17782
|
+
NoHarnessChosen,
|
|
17783
|
+
NoRuntime,
|
|
17784
|
+
AgentRefused,
|
|
17785
|
+
NoSuchSession,
|
|
17786
|
+
RuntimeUnreachable,
|
|
17787
|
+
RuntimeIncompatible
|
|
17788
|
+
])
|
|
17789
|
+
}))), scoped4(make25("Peer.Outbox", { success: OutboxItem, error: Forbidden2, stream: true })), scoped4(make25("Peer.Ack", { payload: { ids: ArraySchema(String4) }, error: Forbidden2 })), scoped4(make25("Machine.Add", {
|
|
17790
|
+
payload: { name: String4, target: String4 },
|
|
17791
|
+
success: Struct({
|
|
17792
|
+
name: String4,
|
|
17793
|
+
id: String4,
|
|
17794
|
+
vibestd: String4,
|
|
17795
|
+
version: String4,
|
|
17796
|
+
notes: ArraySchema(MachineNote)
|
|
17797
|
+
}),
|
|
17798
|
+
error: Union2([Forbidden2, MachineFailed, MachineIncompatible, AlreadyAdded])
|
|
17799
|
+
})), scoped4(make25("Machine.List", { success: ArraySchema(MachineInfo), error: Forbidden2 })), scoped4(make25("Machine.Remove", {
|
|
17800
|
+
payload: { name: String4 },
|
|
17801
|
+
success: Struct({ notes: ArraySchema(MachineNote) }),
|
|
17802
|
+
error: Union2([Forbidden2, UnknownMachine])
|
|
17529
17803
|
}))) {
|
|
17530
17804
|
}
|
|
17805
|
+
var ACCESS = {
|
|
17806
|
+
Ping: ["open", "peer"],
|
|
17807
|
+
Plugins: "open",
|
|
17808
|
+
"Harnesses.List": "open",
|
|
17809
|
+
"Integration.Guard": "open",
|
|
17810
|
+
"Runtimes.Doctor": "open",
|
|
17811
|
+
Subscriptions: "open",
|
|
17812
|
+
Republish: "open",
|
|
17813
|
+
TurnEnd: "open",
|
|
17814
|
+
Prompt: "open",
|
|
17815
|
+
CoordinatorSessionReady: "open",
|
|
17816
|
+
Report: "session",
|
|
17817
|
+
Spawn: "agent",
|
|
17818
|
+
Launch: "agent",
|
|
17819
|
+
List: ["agent", "peer"],
|
|
17820
|
+
Get: ["agent", "peer"],
|
|
17821
|
+
"Inbox.Subscribe": "coordinator",
|
|
17822
|
+
Watch: "cli",
|
|
17823
|
+
"Session.Seen": "cli",
|
|
17824
|
+
"Project.Open": "cli",
|
|
17825
|
+
"Project.MainPlace": "cli",
|
|
17826
|
+
"Project.CoordinatorSession": "agent",
|
|
17827
|
+
"Project.StartMain": "agent",
|
|
17828
|
+
"Project.FocusCoordinator": "cli",
|
|
17829
|
+
"Project.RunningCoordinator": "agent",
|
|
17830
|
+
"Project.StopCoordinator": "agent",
|
|
17831
|
+
"Project.Create": "cli",
|
|
17832
|
+
"Project.Info": "agent",
|
|
17833
|
+
"Project.Search": "agent",
|
|
17834
|
+
Send: ["owner", "peer"],
|
|
17835
|
+
Interrupt: ["owner", "peer"],
|
|
17836
|
+
Peek: ["owner", "peer"],
|
|
17837
|
+
Remove: ["owner", "peer"],
|
|
17838
|
+
"Daemon.Stop": "cli",
|
|
17839
|
+
"Daemon.Handoff": "cli",
|
|
17840
|
+
"Session.Ready": "self",
|
|
17841
|
+
"Agents.Outdated": "cli",
|
|
17842
|
+
"Agents.Restart": "cli",
|
|
17843
|
+
"Peer.Hello": "peer",
|
|
17844
|
+
"Peer.Spawn": "peer",
|
|
17845
|
+
"Peer.Outbox": "peer",
|
|
17846
|
+
"Peer.Ack": "peer",
|
|
17847
|
+
"Machine.Add": "cli",
|
|
17848
|
+
"Machine.List": "cli",
|
|
17849
|
+
"Machine.Remove": "cli"
|
|
17850
|
+
};
|
|
17851
|
+
var PEER_CALLS = new Set(Object.entries(ACCESS).filter(([, access]) => [].concat(access).includes("peer")).map(([method]) => method));
|
|
17531
17852
|
|
|
17532
17853
|
// ../../schema/src/layout.ts
|
|
17533
17854
|
class Layout extends Service()("vibest/Layout") {
|
|
@@ -17539,6 +17860,7 @@ class Layout extends Service()("vibest/Layout") {
|
|
|
17539
17860
|
socket: path.join(home, "vibest.sock"),
|
|
17540
17861
|
httpSocket: path.join(home, "vibest-http.sock"),
|
|
17541
17862
|
daemonInfo: path.join(home, "vibestd.pid"),
|
|
17863
|
+
identity: path.join(home, "identity.json"),
|
|
17542
17864
|
worktrees: path.join(home, "worktrees"),
|
|
17543
17865
|
projects: path.join(home, "projects"),
|
|
17544
17866
|
config: path.join(home, "vibest.json"),
|
|
@@ -17584,13 +17906,19 @@ class IncompatibleDaemon extends TaggedError3()("IncompatibleDaemon", {
|
|
|
17584
17906
|
daemonVersion: String4,
|
|
17585
17907
|
daemonProtocol: NullOr(Number5),
|
|
17586
17908
|
daemon: DaemonIdentity,
|
|
17587
|
-
client: Struct({ version: String4, command: ArraySchema(String4) })
|
|
17909
|
+
client: Struct({ version: String4, command: ArraySchema(String4) }),
|
|
17910
|
+
missing: optional2(String4)
|
|
17588
17911
|
}) {
|
|
17589
17912
|
get message() {
|
|
17590
17913
|
const got = this.daemonProtocol === null ? "no protocol" : `protocol ${this.daemonProtocol}`;
|
|
17591
17914
|
const self = `vibest ${this.client.version} (${this.client.command.map(shellQuote).join(" ")})`;
|
|
17915
|
+
const byHand = stopByHand(this.socket, this.daemon.pid).replace(/^To replace it, /, "");
|
|
17916
|
+
if (this.missing !== undefined)
|
|
17917
|
+
return `vibestd is older (${this.daemonVersion || "unknown"}); run ${MISMATCH_ACTION}. ${described(this.daemonVersion, this.daemon)} on ${this.socket} has no ${this.missing}, which ${self} needs. If \`vibest daemon restart\` cannot replace it: ${byHand}.`;
|
|
17918
|
+
if (this.daemonProtocol !== null && this.daemonProtocol > PROTOCOL)
|
|
17919
|
+
return `${self} speaks protocol ${PROTOCOL}, older than ${described(this.daemonVersion, this.daemon)} on ${this.socket}, which speaks ${got}. Run ${MISMATCH_ACTION} (again, if this was ${MISMATCH_ACTION}): the newest vibest finishes the update and restarts the agents still on the old integration. To keep vibest ${this.client.version} instead (\`vibest daemon restart\` cannot, as vibestd refuses this older protocol): ${byHand}.`;
|
|
17592
17920
|
const mismatch = protocolMismatch(PROTOCOL, this.daemonProtocol ?? 0, this.daemonVersion || "unknown", this.client.version);
|
|
17593
|
-
return `${mismatch.message}. ${described(this.daemonVersion, this.daemon)} on ${this.socket} speaks ${got}; ${self} speaks protocol ${PROTOCOL}. If \`vibest daemon restart\` cannot replace it: ${
|
|
17921
|
+
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.`;
|
|
17594
17922
|
}
|
|
17595
17923
|
}
|
|
17596
17924
|
var protocolHeaders = () => ({ [PROTOCOL_HEADER]: String(PROTOCOL) });
|
|
@@ -17608,7 +17936,7 @@ var fromEnv2 = gen2(function* () {
|
|
|
17608
17936
|
runtime: yield* read("VIBEST_RUNTIME"),
|
|
17609
17937
|
cwd: (yield* Path).resolve(".")
|
|
17610
17938
|
};
|
|
17611
|
-
}).pipe(orElseSucceed2(() => ({})));
|
|
17939
|
+
}).pipe(tapCause2((cause) => logDebug(`session claim headers fell back to the request: ${pretty(cause)}`)), orElseSucceed2(() => ({})));
|
|
17612
17940
|
var claimHeaders = (claim) => claim._tag === "cli" ? succeed7(cliHeaders(claim.repositoryRoot)) : map6(fromEnv2, (more) => sessionHeaders({
|
|
17613
17941
|
...more,
|
|
17614
17942
|
sessionId: claim.sessionId,
|
|
@@ -17616,7 +17944,8 @@ var claimHeaders = (claim) => claim._tag === "cli" ? succeed7(cliHeaders(claim.r
|
|
|
17616
17944
|
harnessSessionId: claim.harnessSessionId,
|
|
17617
17945
|
pluginVersion: claim.pluginVersion
|
|
17618
17946
|
}));
|
|
17619
|
-
var
|
|
17947
|
+
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(SocketConnector, (dial) => dial(socket))), { pingInterval: "1 minute", pingTimeout: "1 day" });
|
|
17620
17949
|
var HOOK_TIMEOUT = seconds(2);
|
|
17621
17950
|
var HOOK_RETRY_DELAY = millis(300);
|
|
17622
17951
|
var CONNECT_CODES = new Set(["ECONNREFUSED", "ENOENT"]);
|
|
@@ -17633,21 +17962,25 @@ var hookCall = (socket, headers, send) => {
|
|
|
17633
17962
|
return gen2(function* () {
|
|
17634
17963
|
const first = yield* once;
|
|
17635
17964
|
if (isSuccess3(first) || !exists(findErrorOption2(first.cause), notConnected))
|
|
17636
|
-
return;
|
|
17965
|
+
return first;
|
|
17637
17966
|
yield* sleep2(HOOK_RETRY_DELAY);
|
|
17638
|
-
yield* once;
|
|
17967
|
+
return yield* once;
|
|
17639
17968
|
});
|
|
17640
17969
|
};
|
|
17641
|
-
var readPing = (socket) => connect2(socket).pipe(flatMap4((client) => client.Ping(undefined)), timeout2("1 second"), option2, scoped2);
|
|
17970
|
+
var readPing = (socket) => connect2(socket).pipe(flatMap4((client) => client.Ping(undefined)), timeout2("1 second"), option2, catchCause2((cause) => hasInterruptsOnly2(cause) ? succeed7(none2()) : failCause3(cause)), scoped2);
|
|
17642
17971
|
var probe = (socket) => readPing(socket).pipe(map6(isSome2), orElseSucceed2(() => false));
|
|
17643
17972
|
var awaitDaemon = (socket) => probe(socket).pipe(repeat2({ until: (up) => up, schedule: spaced("200 millis") }), timeoutOrElse2({ duration: DAEMON_START_TIMEOUT, orElse: () => succeed7(false) }));
|
|
17644
|
-
var incompatibleDaemon = (socket, ping, self) =>
|
|
17645
|
-
|
|
17646
|
-
|
|
17647
|
-
|
|
17648
|
-
|
|
17649
|
-
|
|
17650
|
-
}
|
|
17973
|
+
var incompatibleDaemon = (socket, ping, self, needs) => {
|
|
17974
|
+
const lacks = needs !== undefined && ping.capabilities?.[needs.capability] !== true;
|
|
17975
|
+
return ping.protocol === PROTOCOL && !lacks ? undefined : new IncompatibleDaemon({
|
|
17976
|
+
socket,
|
|
17977
|
+
daemonVersion: ping.version,
|
|
17978
|
+
daemonProtocol: ping.protocol ?? null,
|
|
17979
|
+
daemon: { pid: ping.pid, instance: ping.instance, command: ping.command, startedAt: ping.startedAt },
|
|
17980
|
+
client: { version: VERSION, command: self },
|
|
17981
|
+
...ping.protocol === PROTOCOL && needs !== undefined ? { missing: needs.method } : {}
|
|
17982
|
+
});
|
|
17983
|
+
};
|
|
17651
17984
|
var spawnDaemon = (command, args = [], env) => gen2(function* () {
|
|
17652
17985
|
const layout = yield* Layout;
|
|
17653
17986
|
const path = yield* Path;
|
|
@@ -17656,21 +17989,28 @@ var spawnDaemon = (command, args = [], env) => gen2(function* () {
|
|
|
17656
17989
|
yield* gen2(function* () {
|
|
17657
17990
|
const handle = yield* spawner.spawn(make13("sh", [
|
|
17658
17991
|
"-c",
|
|
17659
|
-
|
|
17992
|
+
'mkdir -p "$1" && log=$2 && shift 2 && { "$@" >>"$log" 2>&1 & }',
|
|
17660
17993
|
"sh",
|
|
17661
17994
|
layout.home,
|
|
17995
|
+
log,
|
|
17662
17996
|
...command,
|
|
17663
17997
|
"daemon",
|
|
17664
17998
|
"--foreground",
|
|
17665
17999
|
...args
|
|
17666
18000
|
], {
|
|
17667
18001
|
detached: true,
|
|
17668
|
-
|
|
18002
|
+
env,
|
|
18003
|
+
extendEnv: true,
|
|
17669
18004
|
stdin: "ignore",
|
|
17670
18005
|
stdout: "ignore",
|
|
17671
|
-
stderr: "
|
|
18006
|
+
stderr: "pipe"
|
|
17672
18007
|
}));
|
|
17673
18008
|
yield* handle.unref;
|
|
18009
|
+
const [said, code] = yield* all2([mkString(decodeText(handle.stderr)), handle.exitCode], {
|
|
18010
|
+
concurrency: "unbounded"
|
|
18011
|
+
});
|
|
18012
|
+
if (code !== 0)
|
|
18013
|
+
return yield* fail6(new Error(`vibestd was not started (exit ${code}): ${said.trim() || "no output"}`));
|
|
17674
18014
|
}).pipe(scoped2, mapError3((e) => new DaemonUnavailable({ socket: layout.socket, message: e.message })));
|
|
17675
18015
|
});
|
|
17676
18016
|
var startDaemon = gen2(function* () {
|
|
@@ -17708,421 +18048,11 @@ var withVibest = (claim, f, options) => gen2(function* () {
|
|
|
17708
18048
|
socket: layout.socket,
|
|
17709
18049
|
message: `vibestd did not answer Ping on ${layout.socket}`
|
|
17710
18050
|
});
|
|
17711
|
-
const incompatible = incompatibleDaemon(layout.socket, ping, yield* VibestCommand);
|
|
18051
|
+
const incompatible = incompatibleDaemon(layout.socket, ping, yield* VibestCommand, options?.needs);
|
|
17712
18052
|
if (incompatible)
|
|
17713
18053
|
return yield* incompatible;
|
|
17714
|
-
return yield* withHeaders(connect2(layout.socket).pipe(flatMap4((client) => f(client))), yield* claimHeaders(claim));
|
|
18054
|
+
return yield* withHeaders(connect2(layout.socket).pipe(flatMap4((client) => f(client, ping))), yield* claimHeaders(claim));
|
|
17715
18055
|
}).pipe(scoped2);
|
|
17716
|
-
// ../../core/src/paths.ts
|
|
17717
|
-
var hostPlatform = globalThis.process?.platform;
|
|
17718
|
-
var writeAtomic = fn2("writeAtomic")(function* (file, content, options) {
|
|
17719
|
-
const fs = yield* FileSystem;
|
|
17720
|
-
const path = yield* Path;
|
|
17721
|
-
yield* fs.makeDirectory(path.dirname(file), { recursive: true });
|
|
17722
|
-
const tmp = `${file}.${yield* nextIntBetween(0, 2 ** 31)}.tmp`;
|
|
17723
|
-
yield* fs.writeFileString(tmp, content, options?.mode === undefined ? undefined : { mode: options.mode });
|
|
17724
|
-
yield* fs.rename(tmp, file);
|
|
17725
|
-
});
|
|
17726
|
-
var interactive = gen2(function* () {
|
|
17727
|
-
const stdio = yield* Stdio;
|
|
17728
|
-
return (yield* stdio.stdinIsTerminal) && (yield* stdio.stdoutIsTerminal);
|
|
17729
|
-
});
|
|
17730
|
-
|
|
17731
|
-
// ../../core/src/guard.ts
|
|
17732
|
-
var PATH_TOOLS = new Set([
|
|
17733
|
-
"read",
|
|
17734
|
-
"write",
|
|
17735
|
-
"edit",
|
|
17736
|
-
"multiedit",
|
|
17737
|
-
"notebookedit",
|
|
17738
|
-
"notebookread",
|
|
17739
|
-
"ls",
|
|
17740
|
-
"grep",
|
|
17741
|
-
"glob",
|
|
17742
|
-
"find",
|
|
17743
|
-
"delete",
|
|
17744
|
-
"list",
|
|
17745
|
-
"readlints"
|
|
17746
|
-
]);
|
|
17747
|
-
var SEARCH_TOOLS = new Set(["grep", "glob", "find"]);
|
|
17748
|
-
var EDIT_TOOLS = new Set(["write", "edit", "multiedit", "notebookedit"]);
|
|
17749
|
-
var fileWritingTool = (tool) => {
|
|
17750
|
-
const name = tool.toLowerCase();
|
|
17751
|
-
return EDIT_TOOLS.has(name) || name === "delete" || name === "strreplace";
|
|
17752
|
-
};
|
|
17753
|
-
var SHELL_TOOLS = new Set(["bash", "powershell", "shell"]);
|
|
17754
|
-
var shellCommand = (input) => str(input.command);
|
|
17755
|
-
var closing = (s, open) => {
|
|
17756
|
-
let depth = 0;
|
|
17757
|
-
for (let i = open;i < s.length; i++) {
|
|
17758
|
-
if (s[i] === "(")
|
|
17759
|
-
depth++;
|
|
17760
|
-
else if (s[i] === ")" && --depth === 0)
|
|
17761
|
-
return i;
|
|
17762
|
-
}
|
|
17763
|
-
return -1;
|
|
17764
|
-
};
|
|
17765
|
-
var splitCommand = (command) => {
|
|
17766
|
-
const commands = [[]];
|
|
17767
|
-
const nested = [];
|
|
17768
|
-
const heredocs = [];
|
|
17769
|
-
let word;
|
|
17770
|
-
let quote;
|
|
17771
|
-
let target = false;
|
|
17772
|
-
const end = () => {
|
|
17773
|
-
if (word !== undefined && target)
|
|
17774
|
-
target = false;
|
|
17775
|
-
else if (word !== undefined)
|
|
17776
|
-
commands.at(-1).push(word);
|
|
17777
|
-
word = undefined;
|
|
17778
|
-
};
|
|
17779
|
-
const next = () => {
|
|
17780
|
-
end();
|
|
17781
|
-
target = false;
|
|
17782
|
-
commands.push([]);
|
|
17783
|
-
};
|
|
17784
|
-
const s = command;
|
|
17785
|
-
for (let i = 0;i < s.length; i++) {
|
|
17786
|
-
const c = s[i];
|
|
17787
|
-
if (quote === "'") {
|
|
17788
|
-
if (c === "'")
|
|
17789
|
-
quote = undefined;
|
|
17790
|
-
else
|
|
17791
|
-
word = (word ?? "") + c;
|
|
17792
|
-
} else if (c === "`" || c === "$" && s[i + 1] === "(") {
|
|
17793
|
-
const close = c === "`" ? s.indexOf("`", i + 1) : closing(s, i + 1);
|
|
17794
|
-
const stop = close === -1 ? s.length : close;
|
|
17795
|
-
nested.push(s.slice(c === "`" ? i + 1 : i + 2, stop));
|
|
17796
|
-
word = (word ?? "") + s.slice(i, stop + 1);
|
|
17797
|
-
i = stop;
|
|
17798
|
-
} else if (quote === '"') {
|
|
17799
|
-
if (c === '"')
|
|
17800
|
-
quote = undefined;
|
|
17801
|
-
else if (c === "\\" && i + 1 < s.length)
|
|
17802
|
-
word = (word ?? "") + s[++i];
|
|
17803
|
-
else
|
|
17804
|
-
word = (word ?? "") + c;
|
|
17805
|
-
} else if (c === "'" || c === '"') {
|
|
17806
|
-
quote = c;
|
|
17807
|
-
word ??= "";
|
|
17808
|
-
} else if (c === "\\" && i + 1 < s.length) {
|
|
17809
|
-
if (s[++i] !== `
|
|
17810
|
-
`)
|
|
17811
|
-
word = (word ?? "") + s[i];
|
|
17812
|
-
} else if (c === " " || c === "\t") {
|
|
17813
|
-
end();
|
|
17814
|
-
} else if (c === "#" && word === undefined) {
|
|
17815
|
-
while (i + 1 < s.length && s[i + 1] !== `
|
|
17816
|
-
`)
|
|
17817
|
-
i++;
|
|
17818
|
-
} else if (c === `
|
|
17819
|
-
` || c === "\r") {
|
|
17820
|
-
next();
|
|
17821
|
-
for (const delimiter of heredocs.splice(0)) {
|
|
17822
|
-
while (i < s.length) {
|
|
17823
|
-
const eol = s.indexOf(`
|
|
17824
|
-
`, i + 1);
|
|
17825
|
-
const line = s.slice(i + 1, eol === -1 ? s.length : eol);
|
|
17826
|
-
i = eol === -1 ? s.length : eol;
|
|
17827
|
-
if (line.replace(/^\t+/, "").replace(/\r$/, "") === delimiter)
|
|
17828
|
-
break;
|
|
17829
|
-
}
|
|
17830
|
-
}
|
|
17831
|
-
} else if (c === "<" || c === ">") {
|
|
17832
|
-
if (word !== undefined && /^\d+$/.test(word))
|
|
17833
|
-
word = undefined;
|
|
17834
|
-
end();
|
|
17835
|
-
if (c === "<" && s[i + 1] === "<" && s[i + 2] !== "<") {
|
|
17836
|
-
i += s[i + 2] === "-" ? 2 : 1;
|
|
17837
|
-
const m = /^\s*(?:'([^']*)'|"([^"]*)"|([^\s;&|<>()]+))/.exec(s.slice(i + 1));
|
|
17838
|
-
if (m) {
|
|
17839
|
-
heredocs.push((m[1] ?? m[2] ?? m[3]).replace(/\\/g, ""));
|
|
17840
|
-
i += m[0].length;
|
|
17841
|
-
}
|
|
17842
|
-
} else {
|
|
17843
|
-
while (">&|<".includes(s[i + 1] ?? "x"))
|
|
17844
|
-
i++;
|
|
17845
|
-
target = true;
|
|
17846
|
-
}
|
|
17847
|
-
} else if ("|&;()".includes(c)) {
|
|
17848
|
-
next();
|
|
17849
|
-
} else {
|
|
17850
|
-
word = (word ?? "") + c;
|
|
17851
|
-
}
|
|
17852
|
-
}
|
|
17853
|
-
end();
|
|
17854
|
-
return [...commands.filter((argv) => argv.length > 0), ...nested.flatMap(splitCommand)];
|
|
17855
|
-
};
|
|
17856
|
-
var IDENTITY = /^VIBEST_(?:SESSION_ID|AGENT)(?:=|$)/;
|
|
17857
|
-
var base = (word) => word.slice(word.lastIndexOf("/") + 1);
|
|
17858
|
-
var WRAPPERS = {
|
|
17859
|
-
env: ["-u", "--unset", "-C", "--chdir", "-S", "--split-string"],
|
|
17860
|
-
command: [],
|
|
17861
|
-
builtin: [],
|
|
17862
|
-
exec: ["-a"],
|
|
17863
|
-
nohup: [],
|
|
17864
|
-
time: [],
|
|
17865
|
-
nice: ["-n"],
|
|
17866
|
-
timeout: ["-s", "-k"],
|
|
17867
|
-
sudo: ["-u", "-g", "-C", "-D", "-h", "-p", "-U", "-r", "-t"],
|
|
17868
|
-
xargs: ["-I", "-n", "-P", "-L", "-d", "-s", "-E", "-a"]
|
|
17869
|
-
};
|
|
17870
|
-
var KEYWORDS = new Set(["!", "{", "if", "then", "elif", "else", "do", "while", "until"]);
|
|
17871
|
-
var SHELLS = new Set(["sh", "bash", "zsh", "dash", "ksh"]);
|
|
17872
|
-
var SETTERS = new Set(["unset", "export", "declare", "typeset", "readonly", "local"]);
|
|
17873
|
-
var programs = (argv, identity = false) => {
|
|
17874
|
-
let i = 0;
|
|
17875
|
-
for (;; ) {
|
|
17876
|
-
const w = argv[i];
|
|
17877
|
-
if (w === undefined)
|
|
17878
|
-
return identity ? [{ argv: [], identity }] : [];
|
|
17879
|
-
const name = base(w);
|
|
17880
|
-
if (/^[A-Za-z_]\w*=/.test(w)) {
|
|
17881
|
-
identity ||= IDENTITY.test(w);
|
|
17882
|
-
i++;
|
|
17883
|
-
} else if (KEYWORDS.has(w)) {
|
|
17884
|
-
i++;
|
|
17885
|
-
} else if (Object.hasOwn(WRAPPERS, name)) {
|
|
17886
|
-
for (i++;argv[i]?.startsWith("-"); i++) {
|
|
17887
|
-
const o = argv[i];
|
|
17888
|
-
if (o === "--") {
|
|
17889
|
-
i++;
|
|
17890
|
-
break;
|
|
17891
|
-
}
|
|
17892
|
-
if (name === "env")
|
|
17893
|
-
identity ||= o === "-" || o === "--ignore-environment" || /^-[^-]*i/.test(o) || IDENTITY.test(o.replace(/^(?:-u|--unset=)/, ""));
|
|
17894
|
-
if (WRAPPERS[name].includes(o)) {
|
|
17895
|
-
if (name === "env" && (o === "-u" || o === "--unset"))
|
|
17896
|
-
identity ||= IDENTITY.test(argv[i + 1] ?? "");
|
|
17897
|
-
i++;
|
|
17898
|
-
}
|
|
17899
|
-
}
|
|
17900
|
-
if (name === "timeout")
|
|
17901
|
-
i++;
|
|
17902
|
-
} else if (SHELLS.has(name)) {
|
|
17903
|
-
const c = argv.findIndex((x, j) => j > i && /^-[a-z]*c[a-z]*$/.test(x));
|
|
17904
|
-
return c === -1 ? [{ argv: argv.slice(i), identity }] : splitCommand(argv[c + 1] ?? "").flatMap((a) => programs(a, identity));
|
|
17905
|
-
} else if (name === "eval") {
|
|
17906
|
-
return splitCommand(argv.slice(i + 1).join(" ")).flatMap((a) => programs(a, identity));
|
|
17907
|
-
} else {
|
|
17908
|
-
return [{ argv: argv.slice(i), identity }];
|
|
17909
|
-
}
|
|
17910
|
-
}
|
|
17911
|
-
};
|
|
17912
|
-
var programsOf = (command) => {
|
|
17913
|
-
const all = splitCommand(command).flatMap((argv) => programs(argv));
|
|
17914
|
-
const changed = all.some((p) => p.argv.length === 0 || SETTERS.has(p.argv[0]) && p.argv.slice(1).some((w) => IDENTITY.test(w)));
|
|
17915
|
-
return changed ? all.map((p) => ({ ...p, identity: true })) : all;
|
|
17916
|
-
};
|
|
17917
|
-
var vibestArgs = (vibest, argv) => {
|
|
17918
|
-
if (argv[0] !== undefined && base(argv[0]) === "vibest")
|
|
17919
|
-
return argv.slice(1);
|
|
17920
|
-
return vibest.every((p, i) => argv[i] === p) ? argv.slice(vibest.length) : undefined;
|
|
17921
|
-
};
|
|
17922
|
-
var HERDR_CONTROL = new Set(["agent", "pane", "tab", "workspace", "worktree", "server", "session"]);
|
|
17923
|
-
var HARNESS_CLIS = new Set(["pi", "claude", "cursor-agent"]);
|
|
17924
|
-
var GH_UNSAFE = new Set(["alias", "extension", "ext", "config", "auth"]);
|
|
17925
|
-
var firstWord = (words) => words.find((w) => !w.startsWith("-")) ?? "";
|
|
17926
|
-
var shellBlock = (command, vibest, coordinator) => {
|
|
17927
|
-
for (const p of programsOf(command)) {
|
|
17928
|
-
const [program = "", ...rest] = p.argv;
|
|
17929
|
-
const name = base(program);
|
|
17930
|
-
if (name === "herdr" && HERDR_CONTROL.has(firstWord(rest)))
|
|
17931
|
-
return "Agents must not control herdr agents, panes, tabs, workspaces or worktrees; vibest manages them.";
|
|
17932
|
-
if (name === "herdr" && !coordinator)
|
|
17933
|
-
return "Sessions do not run herdr; vibest manages it.";
|
|
17934
|
-
if (coordinator && HARNESS_CLIS.has(name))
|
|
17935
|
-
return `The coordinator does not start ${name} itself: it would inherit the coordinator's identity and report its turns as the coordinator's. Start agents with vibest run.`;
|
|
17936
|
-
if (coordinator && name === "gh" && GH_UNSAFE.has(firstWord(rest)))
|
|
17937
|
-
return `gh ${firstWord(rest)} changes gh's credentials or what it runs; ask the user to.`;
|
|
17938
|
-
const args = vibestArgs(vibest, p.argv);
|
|
17939
|
-
if (args === undefined)
|
|
17940
|
-
continue;
|
|
17941
|
-
if (p.identity)
|
|
17942
|
-
return "vibest runs with the agent's own VIBEST_SESSION_ID and VIBEST_AGENT; a command that changes or clears them is refused.";
|
|
17943
|
-
const words = args.slice(0, args.includes("--") ? args.indexOf("--") : undefined);
|
|
17944
|
-
const at = words.indexOf("integration");
|
|
17945
|
-
if (at !== -1 && words[at + 1] === "stop")
|
|
17946
|
-
return "vibest integration stop is the harness's turn-end hook, not an agent command.";
|
|
17947
|
-
if (at !== -1 && words[at + 1] === "prompt")
|
|
17948
|
-
return "vibest integration prompt is the harness's user-prompt hook, not an agent command.";
|
|
17949
|
-
}
|
|
17950
|
-
return;
|
|
17951
|
-
};
|
|
17952
|
-
var physical = (p, seen) => gen2(function* () {
|
|
17953
|
-
const fs = yield* FileSystem;
|
|
17954
|
-
const path = yield* Path;
|
|
17955
|
-
const key = path.resolve(p);
|
|
17956
|
-
if (seen?.has(key))
|
|
17957
|
-
return none2();
|
|
17958
|
-
const visited = new Set(seen).add(key);
|
|
17959
|
-
let current = path.parse(p).root;
|
|
17960
|
-
const parts = p.split(path.sep);
|
|
17961
|
-
for (let i = 0;i < parts.length; i++) {
|
|
17962
|
-
const segment = parts[i];
|
|
17963
|
-
if (segment === "" || segment === ".")
|
|
17964
|
-
continue;
|
|
17965
|
-
if (segment === "..") {
|
|
17966
|
-
current = path.dirname(current);
|
|
17967
|
-
continue;
|
|
17968
|
-
}
|
|
17969
|
-
const joined = path.join(current, segment);
|
|
17970
|
-
const resolved = yield* fs.realPath(joined).pipe(option2);
|
|
17971
|
-
if (isSome2(resolved)) {
|
|
17972
|
-
current = resolved.value;
|
|
17973
|
-
continue;
|
|
17974
|
-
}
|
|
17975
|
-
if (parts.slice(i + 1).some((s) => s !== "" && s !== ".")) {
|
|
17976
|
-
current = joined;
|
|
17977
|
-
continue;
|
|
17978
|
-
}
|
|
17979
|
-
const link = yield* fs.readLink(joined).pipe(map6((target) => ({ target })), catchTag2("PlatformError", (e) => {
|
|
17980
|
-
const code = e.reason.cause?.code;
|
|
17981
|
-
return e.reason._tag === "NotFound" || code === "EINVAL" || code === "ENOTDIR" || code === "ENAMETOOLONG" ? succeed7(undefined) : succeed7("refuse");
|
|
17982
|
-
}));
|
|
17983
|
-
if (link === "refuse" || link?.target === "")
|
|
17984
|
-
return none2();
|
|
17985
|
-
if (link !== undefined) {
|
|
17986
|
-
const target = path.isAbsolute(link.target) ? link.target : path.resolve(current, link.target);
|
|
17987
|
-
return yield* physical(target, visited);
|
|
17988
|
-
}
|
|
17989
|
-
current = joined;
|
|
17990
|
-
}
|
|
17991
|
-
return some2(current);
|
|
17992
|
-
});
|
|
17993
|
-
var str = (value) => typeof value === "string" ? value : undefined;
|
|
17994
|
-
var toolPath = (raw, base, home) => gen2(function* () {
|
|
17995
|
-
const path = yield* Path;
|
|
17996
|
-
let p = raw;
|
|
17997
|
-
if (p.startsWith("file://")) {
|
|
17998
|
-
const fromUrl = yield* try_2(() => new URL(p)).pipe(flatMap4(path.fromFileUrl), option2);
|
|
17999
|
-
if (isNone2(fromUrl) || fromUrl.value === "")
|
|
18000
|
-
return;
|
|
18001
|
-
p = fromUrl.value;
|
|
18002
|
-
}
|
|
18003
|
-
p = p.replace(/^~(?=$|\/)/, home);
|
|
18004
|
-
return path.isAbsolute(p) ? p : `${base}${path.sep}${p}`;
|
|
18005
|
-
});
|
|
18006
|
-
var inside = (p, dir, sep) => p === dir || p.startsWith(dir + sep);
|
|
18007
|
-
var projectDir = gen2(function* () {
|
|
18008
|
-
const own = getOrUndefined(yield* option3(String5("VIBEST_PROJECT_DIR")));
|
|
18009
|
-
return own ? getOrUndefined(yield* physical(own)) : undefined;
|
|
18010
|
-
});
|
|
18011
|
-
var UNRESOLVED_LINK = "The path is a symlink that refers to itself or whose target cannot be read; refused.";
|
|
18012
|
-
var targetsOf = (raw, cwd) => gen2(function* () {
|
|
18013
|
-
const path = yield* Path;
|
|
18014
|
-
const p = yield* toolPath(raw, cwd, yield* String5("HOME"));
|
|
18015
|
-
if (p === undefined)
|
|
18016
|
-
return;
|
|
18017
|
-
const [followed, normalized] = yield* all2([physical(p), physical(path.normalize(p))]);
|
|
18018
|
-
if (isNone2(followed) || isNone2(normalized))
|
|
18019
|
-
return UNRESOLVED_LINK;
|
|
18020
|
-
return [followed.value, normalized.value];
|
|
18021
|
-
});
|
|
18022
|
-
var pathArgs = (input) => [str(input.file_path), str(input.notebook_path), str(input.path)].filter((p) => !!p);
|
|
18023
|
-
var COORDINATOR_EDITS = "The coordinator edits files only in the project folder (VIBEST_PROJECT_DIR); hand other changes to a session.";
|
|
18024
|
-
var coordinator = (call) => gen2(function* () {
|
|
18025
|
-
const tool = call.tool.toLowerCase();
|
|
18026
|
-
if (SHELL_TOOLS.has(tool)) {
|
|
18027
|
-
const command = shellCommand(call.input);
|
|
18028
|
-
if (command === undefined)
|
|
18029
|
-
return "The shell call has no command string; refused.";
|
|
18030
|
-
return shellBlock(command, yield* VibestCommand, true);
|
|
18031
|
-
}
|
|
18032
|
-
if (!fileWritingTool(call.tool))
|
|
18033
|
-
return;
|
|
18034
|
-
const own = yield* projectDir;
|
|
18035
|
-
const raws = pathArgs(call.input);
|
|
18036
|
-
if (own === undefined || raws.length === 0)
|
|
18037
|
-
return COORDINATOR_EDITS;
|
|
18038
|
-
const sep = (yield* Path).sep;
|
|
18039
|
-
for (const raw of raws) {
|
|
18040
|
-
const targets = yield* targetsOf(raw, call.cwd);
|
|
18041
|
-
if (targets === UNRESOLVED_LINK)
|
|
18042
|
-
return UNRESOLVED_LINK;
|
|
18043
|
-
if (targets === undefined || !targets.every((t) => inside(t, own, sep)))
|
|
18044
|
-
return COORDINATOR_EDITS;
|
|
18045
|
-
}
|
|
18046
|
-
return;
|
|
18047
|
-
});
|
|
18048
|
-
var OFF_LIMITS = "The projects directory is off limits to sessions, except this project's folder (VIBEST_PROJECT_DIR).";
|
|
18049
|
-
var SHELL_WORDS = /[^\s'"`;|&()<>=,]+/g;
|
|
18050
|
-
var SHELL_SEARCH = /(?:^|[\s;&|(])(?:rg|ag|ack|grep|egrep|find|fd|tree|du)\s/;
|
|
18051
|
-
var session = fn2("Guard.session")(function* (call) {
|
|
18052
|
-
const path = yield* Path;
|
|
18053
|
-
const layout = yield* Layout;
|
|
18054
|
-
const projectsOpt = yield* physical(layout.projects);
|
|
18055
|
-
const homeOpt = yield* physical(layout.home);
|
|
18056
|
-
if (isNone2(projectsOpt) || isNone2(homeOpt))
|
|
18057
|
-
return OFF_LIMITS;
|
|
18058
|
-
const projects = projectsOpt.value;
|
|
18059
|
-
const vibestHome = homeOpt.value;
|
|
18060
|
-
const own = yield* projectDir;
|
|
18061
|
-
const inOwn = (target) => own !== undefined && inside(target, own, path.sep);
|
|
18062
|
-
const resolve = (raw) => targetsOf(raw, call.cwd);
|
|
18063
|
-
const BAD_URL = "The call names a file URL vibest cannot read; refused.";
|
|
18064
|
-
const blocked = (target, search) => search && inside(projects, target, path.sep) || inside(target, projects, path.sep) && !inOwn(target);
|
|
18065
|
-
const tool = call.tool.toLowerCase();
|
|
18066
|
-
if (SHELL_TOOLS.has(tool)) {
|
|
18067
|
-
const command = shellCommand(call.input);
|
|
18068
|
-
if (command === undefined)
|
|
18069
|
-
return "The shell call has no command string; refused.";
|
|
18070
|
-
const reason = shellBlock(command, yield* VibestCommand, false);
|
|
18071
|
-
if (reason)
|
|
18072
|
-
return reason;
|
|
18073
|
-
const search = SHELL_SEARCH.test(command);
|
|
18074
|
-
const cwd = yield* physical(call.cwd);
|
|
18075
|
-
if (isNone2(cwd) || blocked(cwd.value, false))
|
|
18076
|
-
return OFF_LIMITS;
|
|
18077
|
-
for (const word of command.match(SHELL_WORDS) ?? []) {
|
|
18078
|
-
if (!word.includes("/") && !word.startsWith("~") && !word.includes(".vibest"))
|
|
18079
|
-
continue;
|
|
18080
|
-
if (word.includes(".vibest") && /[*?[{$]/.test(word))
|
|
18081
|
-
return OFF_LIMITS;
|
|
18082
|
-
const targets = yield* resolve(word);
|
|
18083
|
-
if (targets === UNRESOLVED_LINK)
|
|
18084
|
-
return UNRESOLVED_LINK;
|
|
18085
|
-
if (targets === undefined)
|
|
18086
|
-
return BAD_URL;
|
|
18087
|
-
if (targets.some((t) => t === vibestHome || blocked(t, search)))
|
|
18088
|
-
return OFF_LIMITS;
|
|
18089
|
-
if (word.includes(".vibest/projects") && !targets.every(inOwn))
|
|
18090
|
-
return OFF_LIMITS;
|
|
18091
|
-
}
|
|
18092
|
-
return;
|
|
18093
|
-
}
|
|
18094
|
-
if (!PATH_TOOLS.has(tool))
|
|
18095
|
-
return;
|
|
18096
|
-
const search = SEARCH_TOOLS.has(tool);
|
|
18097
|
-
const pattern = tool === "glob" ? str(call.input.pattern)?.split(/[*?[{]/)[0] : undefined;
|
|
18098
|
-
for (const raw of [...pathArgs(call.input), ...pattern ? [pattern] : []]) {
|
|
18099
|
-
const targets = yield* resolve(raw);
|
|
18100
|
-
if (targets === UNRESOLVED_LINK)
|
|
18101
|
-
return UNRESOLVED_LINK;
|
|
18102
|
-
if (targets === undefined)
|
|
18103
|
-
return BAD_URL;
|
|
18104
|
-
if (targets.some((t) => blocked(t, search)))
|
|
18105
|
-
return OFF_LIMITS;
|
|
18106
|
-
}
|
|
18107
|
-
return;
|
|
18108
|
-
});
|
|
18109
|
-
var decodePreToolUse = decodeUnknownEffect2(fromJsonString2(Struct({
|
|
18110
|
-
tool_name: String4,
|
|
18111
|
-
tool_input: Record(String4, Unknown2),
|
|
18112
|
-
cwd: optional2(String4),
|
|
18113
|
-
workspace_roots: optional2(ArraySchema(String4))
|
|
18114
|
-
})));
|
|
18115
|
-
var COORDINATOR = "coordinator";
|
|
18116
|
-
var rulesOf = (agent) => agent === COORDINATOR ? coordinator : session;
|
|
18117
|
-
|
|
18118
|
-
// ../../core/src/results.ts
|
|
18119
|
-
var writeTerminalStatus = (state) => gen2(function* () {
|
|
18120
|
-
const fs = yield* FileSystem;
|
|
18121
|
-
yield* gen2(function* () {
|
|
18122
|
-
const handle = yield* fs.open("/dev/tty", { flag: "w" });
|
|
18123
|
-
yield* handle.write(new TextEncoder().encode(`\x1B]7501;${state}\x1B\\`));
|
|
18124
|
-
}).pipe(scoped2, option2);
|
|
18125
|
-
}).pipe(ignore2);
|
|
18126
18056
|
|
|
18127
18057
|
// src/pi.ts
|
|
18128
18058
|
class Pi extends Service()("@vibest/pi/Pi") {
|
|
@@ -18977,9 +18907,22 @@ function compactUserMessages(pi) {
|
|
|
18977
18907
|
// src/extension.ts
|
|
18978
18908
|
var skillsDir = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "skills");
|
|
18979
18909
|
var encodeJson = encodeSync(fromJsonString2(Unknown2));
|
|
18980
|
-
var
|
|
18910
|
+
var COORDINATOR = "coordinator";
|
|
18911
|
+
var guarded = (agent, sessionId) => gen2(function* () {
|
|
18981
18912
|
const pi = yield* Pi;
|
|
18982
|
-
|
|
18913
|
+
const layout = yield* Layout;
|
|
18914
|
+
yield* pi.handle("tool_call", (e, ctx) => gen2(function* () {
|
|
18915
|
+
const headers = yield* claimHeaders(sessionId ? { _tag: "session", sessionId, pluginVersion: VERSION } : { _tag: "cli", repositoryRoot: ctx.cwd });
|
|
18916
|
+
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", agent, input }));
|
|
18918
|
+
if (isFailure3(exit))
|
|
18919
|
+
return {
|
|
18920
|
+
block: true,
|
|
18921
|
+
reason: `vibest could not check this tool call (${pretty(exit.cause)}); it is refused.`
|
|
18922
|
+
};
|
|
18923
|
+
const reason = exit.value.answer;
|
|
18924
|
+
return typeof reason === "string" && reason ? { block: true, reason } : undefined;
|
|
18925
|
+
}));
|
|
18983
18926
|
});
|
|
18984
18927
|
var lastReply = (messages) => {
|
|
18985
18928
|
const message = messages.findLast((m) => m.role === "assistant");
|
|
@@ -18992,7 +18935,7 @@ var piHeaders = (sessionId, ctx) => claimHeaders({
|
|
|
18992
18935
|
harnessSessionId: ctx.sessionManager.getSessionId(),
|
|
18993
18936
|
pluginVersion: VERSION
|
|
18994
18937
|
});
|
|
18995
|
-
var
|
|
18938
|
+
var session = (sessionId) => effectDiscard(gen2(function* () {
|
|
18996
18939
|
const pi = yield* Pi;
|
|
18997
18940
|
const layout = yield* Layout;
|
|
18998
18941
|
const root = yield* make24(false);
|
|
@@ -19005,13 +18948,11 @@ var session2 = (sessionId) => effectDiscard(gen2(function* () {
|
|
|
19005
18948
|
const headers = yield* piHeaders(sessionId, ctx);
|
|
19006
18949
|
const event = encodeJson({ type: "input", text: e.text, source: e.source });
|
|
19007
18950
|
yield* hookCall(layout.socket, headers, (client) => client.Prompt({ sessionId, harness: "pi", event }));
|
|
19008
|
-
yield* writeTerminalStatus("working");
|
|
19009
18951
|
}));
|
|
19010
18952
|
yield* pi.handle("agent_settled", (e, ctx) => gen2(function* () {
|
|
19011
18953
|
if (!(yield* get2(root)) || !ctx.isIdle())
|
|
19012
18954
|
return;
|
|
19013
18955
|
const { text, error } = yield* get2(reply);
|
|
19014
|
-
yield* writeTerminalStatus("idle");
|
|
19015
18956
|
const headers = yield* piHeaders(sessionId, ctx);
|
|
19016
18957
|
const event = encodeJson({ type: "agent_settled", text, error, aborted: e.aborted });
|
|
19017
18958
|
yield* hookCall(layout.socket, headers, (client) => client.TurnEnd({ sessionId, harness: "pi", event }));
|
|
@@ -19032,7 +18973,7 @@ var reportSession = fn2("reportSession")(function* (sessionId) {
|
|
|
19032
18973
|
yield* pi.handle("session_start", (event, ctx) => event.reason === "new" || event.reason === "resume" || event.reason === "fork" ? send(ctx) : void_3);
|
|
19033
18974
|
yield* pi.handle("agent_end", (_event, ctx) => send(ctx));
|
|
19034
18975
|
});
|
|
19035
|
-
var
|
|
18976
|
+
var coordinator = effectDiscard(gen2(function* () {
|
|
19036
18977
|
const pi = yield* Pi;
|
|
19037
18978
|
yield* pi.handle("resources_discover", () => succeed7({ skillPaths: [skillsDir] }));
|
|
19038
18979
|
yield* pi.handle("before_agent_start", (e) => sync2(() => {
|
|
@@ -19059,18 +19000,22 @@ var coordinator2 = effectDiscard(gen2(function* () {
|
|
|
19059
19000
|
}));
|
|
19060
19001
|
var ready = (sessionId) => effectDiscard(gen2(function* () {
|
|
19061
19002
|
const pi = yield* Pi;
|
|
19062
|
-
|
|
19003
|
+
const scope = yield* scope2;
|
|
19004
|
+
yield* pi.handle("session_start", (_e, ctx) => ctx.mode !== "tui" ? void_3 : withVibest({ _tag: "session", sessionId, pluginVersion: VERSION }, (client) => client["Session.Ready"]({ id: sessionId, pid: process.pid }), { start: false }).pipe(timeout2("2 seconds"), retry2({
|
|
19005
|
+
while: (e) => e._tag === "DaemonUnavailable" || e._tag === "RpcClientError" || e._tag === "TimeoutError",
|
|
19006
|
+
schedule: spaced("1 second")
|
|
19007
|
+
}), ignore2, forkIn2(scope), asVoid2));
|
|
19063
19008
|
}));
|
|
19064
19009
|
var extension2 = unwrap(gen2(function* () {
|
|
19065
19010
|
const agent = getOrUndefined(yield* option3(String5("VIBEST_AGENT")));
|
|
19066
19011
|
if (!agent)
|
|
19067
19012
|
return empty4;
|
|
19068
|
-
const guarding = effectDiscard(guarded(rulesOf(agent)));
|
|
19069
19013
|
const sessionId = getOrUndefined(yield* option3(String5("VIBEST_SESSION_ID")));
|
|
19014
|
+
const guarding = effectDiscard(guarded(agent, sessionId));
|
|
19070
19015
|
const guard = sessionId ? merge2(guarding, ready(sessionId)) : guarding;
|
|
19071
19016
|
if (agent === COORDINATOR)
|
|
19072
|
-
return
|
|
19073
|
-
return sessionId ?
|
|
19017
|
+
return coordinator.pipe(provideMerge(guard));
|
|
19018
|
+
return sessionId ? session(sessionId).pipe(provideMerge(guard)) : guard;
|
|
19074
19019
|
}));
|
|
19075
19020
|
var vibestCommand = effect(VibestCommand, schema(fromJsonString2(ArraySchema(String4)), "VIBEST_COMMAND").pipe(withDefault3(["vibest"])));
|
|
19076
19021
|
var services = mergeAll2(Layout.layer, layer.pipe(provide2(layer2)), layer2, succeed6(SocketConnector, (endpoint) => makeNet({ path: endpoint })), vibestCommand).pipe(provideMerge(layer3));
|