@vibest/cli 0.0.1-beta.17 → 0.0.1-beta.18
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 +18 -2
- package/harnesses/claude/hooks/register.mjs +6 -6
- 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 +460 -526
- 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);
|
|
@@ -7935,7 +7923,6 @@ var buildFromOptions = (options) => {
|
|
|
7935
7923
|
|
|
7936
7924
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Effect.js
|
|
7937
7925
|
var isEffect2 = isEffect;
|
|
7938
|
-
var all2 = all;
|
|
7939
7926
|
var forEach2 = forEach;
|
|
7940
7927
|
var whileLoop2 = whileLoop;
|
|
7941
7928
|
var tryPromise2 = tryPromise;
|
|
@@ -13862,7 +13849,26 @@ var toCodecStringTreeAST = /* @__PURE__ */ applyToSelfOrLastLinkEncodingIdempote
|
|
|
13862
13849
|
});
|
|
13863
13850
|
|
|
13864
13851
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Struct.js
|
|
13852
|
+
var pick = /* @__PURE__ */ dual(2, (self, keys) => {
|
|
13853
|
+
return buildStruct(self, (k, v) => hasPropertyKey(keys, k) ? [k, v] : undefined);
|
|
13854
|
+
});
|
|
13865
13855
|
var lambda = (f) => f;
|
|
13856
|
+
function hasPropertyKey(keys, key) {
|
|
13857
|
+
return keys.some((candidate) => candidate === key || typeof candidate === "number" && String(candidate) === key);
|
|
13858
|
+
}
|
|
13859
|
+
function buildStruct(source, f) {
|
|
13860
|
+
const out = {};
|
|
13861
|
+
for (const k of Reflect.ownKeys(source)) {
|
|
13862
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, k))
|
|
13863
|
+
continue;
|
|
13864
|
+
const res = f(k, source[k]);
|
|
13865
|
+
if (res) {
|
|
13866
|
+
const [nk, nv] = res;
|
|
13867
|
+
assignProperty(out, nk, nv);
|
|
13868
|
+
}
|
|
13869
|
+
}
|
|
13870
|
+
return out;
|
|
13871
|
+
}
|
|
13866
13872
|
|
|
13867
13873
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schemaError.js
|
|
13868
13874
|
var SchemaErrorTypeId = "~effect/Schema/SchemaError";
|
|
@@ -15134,7 +15140,7 @@ var fromDuplex = (open, options) => withFiber2((fiber) => {
|
|
|
15134
15140
|
});
|
|
15135
15141
|
|
|
15136
15142
|
// ../../protocol/src/protocol.ts
|
|
15137
|
-
var PROTOCOL =
|
|
15143
|
+
var PROTOCOL = 8;
|
|
15138
15144
|
var MISMATCH_ACTION = "vibest update";
|
|
15139
15145
|
var protocolMismatch = (caller, server, version, callerVersion) => ({
|
|
15140
15146
|
protocol: server,
|
|
@@ -15174,18 +15180,6 @@ var sessionHeaders = (who) => {
|
|
|
15174
15180
|
headers[REPOSITORY_HEADER] = who.repositoryRoot;
|
|
15175
15181
|
return headers;
|
|
15176
15182
|
};
|
|
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
15183
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/ConfigProvider.js
|
|
15190
15184
|
function makeValue(value) {
|
|
15191
15185
|
return {
|
|
@@ -15574,9 +15568,100 @@ var makeUnsafe6 = (value) => {
|
|
|
15574
15568
|
var make24 = (value) => sync2(() => makeUnsafe6(value));
|
|
15575
15569
|
var get2 = (self) => sync2(() => self.ref.current);
|
|
15576
15570
|
var set2 = /* @__PURE__ */ dual(2, (self, value) => sync2(() => set(self.ref, value)));
|
|
15577
|
-
//
|
|
15578
|
-
|
|
15579
|
-
|
|
15571
|
+
// ../../schema/src/machine.ts
|
|
15572
|
+
class MachineFailed extends TaggedError3()("MachineFailed", { message: String4 }) {
|
|
15573
|
+
}
|
|
15574
|
+
|
|
15575
|
+
class UnknownMachine extends TaggedError3()("UnknownMachine", {
|
|
15576
|
+
machine: String4,
|
|
15577
|
+
machines: ArraySchema(String4)
|
|
15578
|
+
}) {
|
|
15579
|
+
get message() {
|
|
15580
|
+
const known = this.machines.length === 0 ? "none is added (vibest machine add)" : `machines: ${this.machines.join(", ")}`;
|
|
15581
|
+
return `unknown machine ${JSON.stringify(this.machine)}; ${known}`;
|
|
15582
|
+
}
|
|
15583
|
+
}
|
|
15584
|
+
|
|
15585
|
+
class MachineUnavailable extends TaggedError3()("MachineUnavailable", {
|
|
15586
|
+
machine: String4,
|
|
15587
|
+
message: String4
|
|
15588
|
+
}) {
|
|
15589
|
+
}
|
|
15590
|
+
|
|
15591
|
+
class MachineIncompatible extends TaggedError3()("MachineIncompatible", {
|
|
15592
|
+
machine: String4,
|
|
15593
|
+
message: String4
|
|
15594
|
+
}) {
|
|
15595
|
+
}
|
|
15596
|
+
|
|
15597
|
+
class AlreadyAdded extends TaggedError3()("AlreadyAdded", {
|
|
15598
|
+
machine: String4,
|
|
15599
|
+
id: String4
|
|
15600
|
+
}) {
|
|
15601
|
+
get message() {
|
|
15602
|
+
return `this is the vibestd already added as ${this.machine} (${this.id.slice(0, 8)}); use that name`;
|
|
15603
|
+
}
|
|
15604
|
+
}
|
|
15605
|
+
var MachineState = Literals(["connecting", "connected", "unreachable", "different"]);
|
|
15606
|
+
var MachineNote = Struct({
|
|
15607
|
+
plugin: optional2(String4),
|
|
15608
|
+
message: String4,
|
|
15609
|
+
fix: optional2(String4)
|
|
15610
|
+
});
|
|
15611
|
+
var RuntimeThere = Struct({
|
|
15612
|
+
kind: String4,
|
|
15613
|
+
status: Literals(["online", "offline", "blocked"]),
|
|
15614
|
+
reason: optional2(String4),
|
|
15615
|
+
link: optional2(Record(String4, String4))
|
|
15616
|
+
});
|
|
15617
|
+
var RuntimeView = Struct({
|
|
15618
|
+
kind: String4,
|
|
15619
|
+
status: RuntimeThere.fields.status,
|
|
15620
|
+
reason: optional2(String4),
|
|
15621
|
+
here: Struct({
|
|
15622
|
+
visible: Boolean3,
|
|
15623
|
+
as: optional2(String4),
|
|
15624
|
+
note: optional2(String4)
|
|
15625
|
+
})
|
|
15626
|
+
});
|
|
15627
|
+
var MachineInfo = Struct({
|
|
15628
|
+
name: String4,
|
|
15629
|
+
target: String4,
|
|
15630
|
+
id: String4,
|
|
15631
|
+
state: MachineState,
|
|
15632
|
+
since: Number5,
|
|
15633
|
+
reason: optional2(String4),
|
|
15634
|
+
connectedAt: Number5,
|
|
15635
|
+
vibestd: optional2(String4),
|
|
15636
|
+
version: optional2(String4),
|
|
15637
|
+
runtimes: optional2(ArraySchema(RuntimeView)),
|
|
15638
|
+
runtimesAt: optional2(Number5),
|
|
15639
|
+
notes: optional2(ArraySchema(Struct({ ...MachineNote.fields, at: Number5 })))
|
|
15640
|
+
});
|
|
15641
|
+
var ListedMachine = MachineInfo.mapFields(pick(["name", "state", "since", "reason"]));
|
|
15642
|
+
|
|
15643
|
+
class NoProject extends TaggedError3()("NoProject", { message: String4 }) {
|
|
15644
|
+
}
|
|
15645
|
+
|
|
15646
|
+
class NoCommit extends TaggedError3()("NoCommit", { message: String4 }) {
|
|
15647
|
+
}
|
|
15648
|
+
var OUTBOX_ITEM_MAX = 1024 * 1024;
|
|
15649
|
+
var PROMPT_MAX = 1024 * 1024;
|
|
15650
|
+
|
|
15651
|
+
class PromptTooLarge extends TaggedError3()("PromptTooLarge", { bytes: Number5 }) {
|
|
15652
|
+
get message() {
|
|
15653
|
+
return `the prompt is ${this.bytes} bytes; another machine takes at most ${PROMPT_MAX} bytes (1 MiB)`;
|
|
15654
|
+
}
|
|
15655
|
+
}
|
|
15656
|
+
var OutboxItem = Struct({
|
|
15657
|
+
id: String4,
|
|
15658
|
+
session: String4,
|
|
15659
|
+
recipient: String4,
|
|
15660
|
+
kind: Literals(["result", "notice"]),
|
|
15661
|
+
content: String4,
|
|
15662
|
+
cut: optional2(Boolean3)
|
|
15663
|
+
});
|
|
15664
|
+
|
|
15580
15665
|
// ../../schema/src/id.ts
|
|
15581
15666
|
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
15667
|
|
|
@@ -15680,7 +15765,7 @@ var PluginInfo = Struct({
|
|
|
15680
15765
|
var ProjectKind = Literals(["docs", "memories", "artifacts"]);
|
|
15681
15766
|
var ProjectInfoResult = Struct({
|
|
15682
15767
|
directory: String4,
|
|
15683
|
-
|
|
15768
|
+
preferences: String4,
|
|
15684
15769
|
docs: String4,
|
|
15685
15770
|
memories: String4,
|
|
15686
15771
|
artifacts: String4
|
|
@@ -15725,7 +15810,7 @@ var InboxRow = Struct({
|
|
|
15725
15810
|
status: InboxStatus,
|
|
15726
15811
|
createdAt: Number5
|
|
15727
15812
|
});
|
|
15728
|
-
|
|
15813
|
+
|
|
15729
15814
|
class HarnessUnavailable extends TaggedError3()("HarnessUnavailable", {
|
|
15730
15815
|
harness: String4,
|
|
15731
15816
|
message: String4
|
|
@@ -15797,7 +15882,7 @@ class NotReady extends TaggedError3()("NotReady", {
|
|
|
15797
15882
|
|
|
15798
15883
|
class NoHarnessChosen extends TaggedError3()("NoHarnessChosen", {}) {
|
|
15799
15884
|
get message() {
|
|
15800
|
-
return "no harness
|
|
15885
|
+
return "no harness to inherit: name one, for example `vibest run claude -- <prompt>`";
|
|
15801
15886
|
}
|
|
15802
15887
|
}
|
|
15803
15888
|
|
|
@@ -15825,7 +15910,7 @@ var SubscriptionLimit = Struct({
|
|
|
15825
15910
|
resetTime: NullOr(Number5)
|
|
15826
15911
|
});
|
|
15827
15912
|
var Subscription = Struct({
|
|
15828
|
-
harness:
|
|
15913
|
+
harness: String4,
|
|
15829
15914
|
provider: String4,
|
|
15830
15915
|
machine: Literal2("local"),
|
|
15831
15916
|
account: SubscriptionAccount,
|
|
@@ -15855,9 +15940,9 @@ function Stream2(success, error) {
|
|
|
15855
15940
|
}
|
|
15856
15941
|
|
|
15857
15942
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/rpc/Rpc.js
|
|
15858
|
-
var
|
|
15943
|
+
var TypeId29 = "~effect/rpc/Rpc";
|
|
15859
15944
|
var Proto8 = {
|
|
15860
|
-
[
|
|
15945
|
+
[TypeId29]: TypeId29,
|
|
15861
15946
|
pipe() {
|
|
15862
15947
|
return pipeArguments(this, arguments);
|
|
15863
15948
|
},
|
|
@@ -15991,8 +16076,8 @@ var exitSchema = (self) => {
|
|
|
15991
16076
|
var WrapperTypeId = "~effect/rpc/Rpc/Wrapper";
|
|
15992
16077
|
var isWrapper = (u) => (WrapperTypeId in u);
|
|
15993
16078
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/http/HttpClientError.js
|
|
15994
|
-
var
|
|
15995
|
-
class HttpClientErrorSchema extends (/* @__PURE__ */ Error4(
|
|
16079
|
+
var TypeId30 = "~effect/http/HttpClientError";
|
|
16080
|
+
class HttpClientErrorSchema extends (/* @__PURE__ */ Error4(TypeId30)({
|
|
15996
16081
|
_tag: /* @__PURE__ */ tag("HttpError"),
|
|
15997
16082
|
kind: /* @__PURE__ */ Literals(["EncodeError", "DecodeError", "TransportError", "InvalidUrlError", "StatusCodeError", "EmptyBodyError"]),
|
|
15998
16083
|
cause: /* @__PURE__ */ optional2(/* @__PURE__ */ Defect())
|
|
@@ -16069,7 +16154,7 @@ var spanAttributes = (tag, attributes) => ({
|
|
|
16069
16154
|
});
|
|
16070
16155
|
|
|
16071
16156
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/rpc/RpcClientError.js
|
|
16072
|
-
var
|
|
16157
|
+
var TypeId31 = "~effect/rpc/RpcClientError";
|
|
16073
16158
|
|
|
16074
16159
|
class RpcClientDefect extends (/* @__PURE__ */ Error4("effect/rpc/RpcClientError/RpcClientDefect")({
|
|
16075
16160
|
_tag: /* @__PURE__ */ tag("RpcClientDefect"),
|
|
@@ -16078,11 +16163,11 @@ class RpcClientDefect extends (/* @__PURE__ */ Error4("effect/rpc/RpcClientError
|
|
|
16078
16163
|
})) {
|
|
16079
16164
|
}
|
|
16080
16165
|
|
|
16081
|
-
class RpcClientError extends (/* @__PURE__ */ Error4(
|
|
16166
|
+
class RpcClientError extends (/* @__PURE__ */ Error4(TypeId31)({
|
|
16082
16167
|
_tag: /* @__PURE__ */ tag("RpcClientError"),
|
|
16083
16168
|
reason: /* @__PURE__ */ Union2([WorkerErrorReason, SocketErrorReason, HttpClientErrorSchema, RpcClientDefect])
|
|
16084
16169
|
})) {
|
|
16085
|
-
[
|
|
16170
|
+
[TypeId31] = TypeId31;
|
|
16086
16171
|
get message() {
|
|
16087
16172
|
return `${this.reason._tag}: ${this.reason.message}`;
|
|
16088
16173
|
}
|
|
@@ -17125,7 +17210,7 @@ var make27 = (...rpcs) => makeProto2({
|
|
|
17125
17210
|
annotations: empty3()
|
|
17126
17211
|
});
|
|
17127
17212
|
// ../../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/rpc/RpcMiddleware.js
|
|
17128
|
-
var
|
|
17213
|
+
var TypeId32 = "~effect/rpc/RpcMiddleware";
|
|
17129
17214
|
var Service2 = () => (id, options) => {
|
|
17130
17215
|
const limit = getStackTraceLimit();
|
|
17131
17216
|
let creationError;
|
|
@@ -17143,7 +17228,7 @@ var Service2 = () => (id, options) => {
|
|
|
17143
17228
|
return creationError?.stack;
|
|
17144
17229
|
}
|
|
17145
17230
|
});
|
|
17146
|
-
ServiceClass_[
|
|
17231
|
+
ServiceClass_[TypeId32] = TypeId32;
|
|
17147
17232
|
ServiceClass_.error = options?.error ?? Never2;
|
|
17148
17233
|
ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
|
|
17149
17234
|
return ServiceClass;
|
|
@@ -17151,15 +17236,17 @@ var Service2 = () => (id, options) => {
|
|
|
17151
17236
|
// ../../protocol/package.json
|
|
17152
17237
|
var package_default = {
|
|
17153
17238
|
name: "@vibest/protocol",
|
|
17154
|
-
version: "0.0.1-beta.
|
|
17239
|
+
version: "0.0.1-beta.18",
|
|
17155
17240
|
private: true,
|
|
17156
17241
|
license: "MIT",
|
|
17157
17242
|
type: "module",
|
|
17158
17243
|
exports: {
|
|
17244
|
+
"./scripts/*": "./scripts/*.ts",
|
|
17159
17245
|
"./*": "./src/*.ts"
|
|
17160
17246
|
},
|
|
17161
17247
|
scripts: {
|
|
17162
|
-
typecheck: "tsrs --noEmit --fast"
|
|
17248
|
+
typecheck: "tsrs --noEmit --fast && tsrs --noEmit --fast -p tsconfig.scripts.json",
|
|
17249
|
+
contract: "bun scripts/contract.ts"
|
|
17163
17250
|
},
|
|
17164
17251
|
dependencies: {
|
|
17165
17252
|
"@vibest/schema": "workspace:*",
|
|
@@ -17191,10 +17278,16 @@ var RuntimeDoctor = Struct({
|
|
|
17191
17278
|
fix: optional2(String4)
|
|
17192
17279
|
}))
|
|
17193
17280
|
});
|
|
17281
|
+
var UpdateStatus = Struct({
|
|
17282
|
+
checked: NullOr(Number5),
|
|
17283
|
+
latest: NullOr(String4),
|
|
17284
|
+
checking: Boolean3
|
|
17285
|
+
});
|
|
17194
17286
|
var PingResult = Struct({
|
|
17195
17287
|
protocol: optional2(Number5),
|
|
17196
17288
|
version: String4,
|
|
17197
17289
|
runtimes: optional2(ArraySchema(RuntimeStatus)),
|
|
17290
|
+
update: optional2(UpdateStatus),
|
|
17198
17291
|
...DaemonIdentity.fields,
|
|
17199
17292
|
capabilities: optional2(Record(String4, Boolean3))
|
|
17200
17293
|
});
|
|
@@ -17226,6 +17319,11 @@ class Forbidden2 extends TaggedError3()("Forbidden", {
|
|
|
17226
17319
|
}) {
|
|
17227
17320
|
}
|
|
17228
17321
|
|
|
17322
|
+
class ProjectCreateFailed extends TaggedError3()("ProjectCreateFailed", {
|
|
17323
|
+
message: String4
|
|
17324
|
+
}) {
|
|
17325
|
+
}
|
|
17326
|
+
|
|
17229
17327
|
class Caller extends Service()("vibest/Caller") {
|
|
17230
17328
|
}
|
|
17231
17329
|
|
|
@@ -17279,7 +17377,7 @@ var SessionInfo = Struct({
|
|
|
17279
17377
|
id: String4,
|
|
17280
17378
|
name: String4,
|
|
17281
17379
|
agent: String4,
|
|
17282
|
-
harness:
|
|
17380
|
+
harness: String4,
|
|
17283
17381
|
provider: NullOr(String4),
|
|
17284
17382
|
model: NullOr(String4),
|
|
17285
17383
|
status: AgentStatus,
|
|
@@ -17300,34 +17398,82 @@ var SessionInfo = Struct({
|
|
|
17300
17398
|
status: MessageStatus,
|
|
17301
17399
|
summary: String4,
|
|
17302
17400
|
endedAt: NullOr(Number5)
|
|
17303
|
-
}))
|
|
17401
|
+
})),
|
|
17402
|
+
machine: optional2(String4),
|
|
17403
|
+
view: optional2(String4)
|
|
17304
17404
|
});
|
|
17405
|
+
var LINE_ERRORS = [UnknownMachine, MachineUnavailable, MachineIncompatible];
|
|
17305
17406
|
var InboxMessage = Struct({ ...InboxRow.fields, details: Record(String4, Unknown2) });
|
|
17306
17407
|
var SessionStatusInfo = Struct({ ...SessionInfo.fields, result: NullOr(InboxMessage) });
|
|
17408
|
+
var HarnessModel = Struct({
|
|
17409
|
+
provider: NullOr(String4),
|
|
17410
|
+
model: String4,
|
|
17411
|
+
name: String4,
|
|
17412
|
+
default: Boolean3
|
|
17413
|
+
});
|
|
17414
|
+
var HarnessChoice = Struct({
|
|
17415
|
+
harness: String4,
|
|
17416
|
+
binary: String4,
|
|
17417
|
+
problem: NullOr(String4),
|
|
17418
|
+
models: ArraySchema(HarnessModel)
|
|
17419
|
+
});
|
|
17420
|
+
var ProjectActivity = Literals(["blocked", "done", "working", "idle"]);
|
|
17421
|
+
var ProjectRow = Struct({
|
|
17422
|
+
id: String4,
|
|
17423
|
+
directory: NullOr(String4),
|
|
17424
|
+
entrySessionId: NullOr(String4),
|
|
17425
|
+
activity: ProjectActivity
|
|
17426
|
+
});
|
|
17427
|
+
var WatchSession = Struct({
|
|
17428
|
+
...SessionInfo.fields,
|
|
17429
|
+
parentId: NullOr(String4),
|
|
17430
|
+
turn: NullOr(Number5)
|
|
17431
|
+
});
|
|
17432
|
+
var WatchEvent = Union2([
|
|
17433
|
+
TaggedStruct("Snapshot", { projects: ArraySchema(ProjectRow), sessions: ArraySchema(WatchSession) }),
|
|
17434
|
+
TaggedStruct("Project", { project: ProjectRow }),
|
|
17435
|
+
TaggedStruct("Session", { session: WatchSession }),
|
|
17436
|
+
TaggedStruct("SessionEnded", { id: String4, projectId: String4 })
|
|
17437
|
+
]);
|
|
17438
|
+
|
|
17439
|
+
class WatchLagged extends TaggedError3()("WatchLagged", { message: String4 }) {
|
|
17440
|
+
}
|
|
17307
17441
|
|
|
17308
17442
|
class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4(admitted(make25("Spawn", {
|
|
17309
17443
|
payload: {
|
|
17310
17444
|
name: optional2(String4),
|
|
17311
17445
|
prompt: String4,
|
|
17312
|
-
harness: optional2(
|
|
17446
|
+
harness: optional2(String4),
|
|
17313
17447
|
provider: optional2(String4),
|
|
17314
17448
|
model: optional2(String4),
|
|
17315
17449
|
env: optional2(Record(String4, String4)),
|
|
17316
17450
|
agent: optional2(String4),
|
|
17317
|
-
|
|
17451
|
+
callerEnv: Record(String4, String4),
|
|
17452
|
+
runtimeSession: optional2(String4),
|
|
17318
17453
|
peer: optional2(String4),
|
|
17319
|
-
archive: optional2(Boolean3)
|
|
17454
|
+
archive: optional2(Boolean3),
|
|
17455
|
+
runtime: optional2(String4),
|
|
17456
|
+
request: optional2(String4),
|
|
17457
|
+
machine: optional2(String4)
|
|
17320
17458
|
},
|
|
17321
17459
|
success: Struct({
|
|
17322
17460
|
id: String4,
|
|
17323
|
-
harness:
|
|
17461
|
+
harness: String4,
|
|
17324
17462
|
provider: optional2(String4),
|
|
17325
17463
|
model: optional2(String4),
|
|
17326
|
-
...Routing.fields
|
|
17464
|
+
...Routing.fields,
|
|
17465
|
+
notes: optional2(ArraySchema(MachineNote))
|
|
17327
17466
|
}),
|
|
17328
17467
|
error: Union2([
|
|
17329
17468
|
InvalidCaller,
|
|
17330
17469
|
Forbidden2,
|
|
17470
|
+
MachineFailed,
|
|
17471
|
+
UnknownMachine,
|
|
17472
|
+
MachineUnavailable,
|
|
17473
|
+
MachineIncompatible,
|
|
17474
|
+
NoProject,
|
|
17475
|
+
NoCommit,
|
|
17476
|
+
PromptTooLarge,
|
|
17331
17477
|
LimitReached,
|
|
17332
17478
|
AllocationFailed,
|
|
17333
17479
|
HarnessUnavailable,
|
|
@@ -17341,21 +17487,30 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17341
17487
|
RuntimeUnreachable,
|
|
17342
17488
|
RuntimeIncompatible
|
|
17343
17489
|
])
|
|
17344
|
-
}))), protocol(make25("Plugins", { success: ArraySchema(PluginInfo) })), protocol(make25("
|
|
17490
|
+
}))), protocol(make25("Plugins", { success: ArraySchema(PluginInfo) })), protocol(make25("Harnesses.List", {
|
|
17491
|
+
payload: { provider: optional2(String4) },
|
|
17492
|
+
success: ArraySchema(HarnessChoice)
|
|
17493
|
+
})), scoped4(make25("Integration.Guard", {
|
|
17494
|
+
payload: { harness: String4, agent: String4, input: String4 },
|
|
17495
|
+
success: Struct({ answer: optional2(Unknown2) }),
|
|
17496
|
+
error: Union2([HarnessUnavailable, InvalidCaller])
|
|
17497
|
+
})), protocol(make25("Runtimes.Doctor", {
|
|
17345
17498
|
payload: { harnesses: ArraySchema(String4) },
|
|
17346
17499
|
success: ArraySchema(RuntimeDoctor)
|
|
17347
17500
|
})), protocol(make25("Subscriptions", { success: ArraySchema(Subscription) })), protocol(make25("Republish", { success: Number5 })), scoped4(admitted(make25("Launch", {
|
|
17348
17501
|
payload: {
|
|
17349
17502
|
argv: ArraySchema(String4),
|
|
17350
17503
|
focus: Boolean3,
|
|
17351
|
-
|
|
17504
|
+
callerEnv: Record(String4, String4),
|
|
17505
|
+
runtimeSession: optional2(String4),
|
|
17352
17506
|
runtime: optional2(String4)
|
|
17353
17507
|
},
|
|
17354
17508
|
success: Struct({
|
|
17355
17509
|
runtime: String4,
|
|
17356
17510
|
terminal: String4,
|
|
17357
17511
|
place: String4,
|
|
17358
|
-
attach: NullOr(ArraySchema(String4))
|
|
17512
|
+
attach: NullOr(ArraySchema(String4)),
|
|
17513
|
+
routing: optional2(String4)
|
|
17359
17514
|
}),
|
|
17360
17515
|
error: Union2([
|
|
17361
17516
|
InvalidCaller,
|
|
@@ -17367,51 +17522,77 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17367
17522
|
AgentRefused
|
|
17368
17523
|
])
|
|
17369
17524
|
}))), scoped4(admitted(make25("Send", {
|
|
17370
|
-
payload: { id: String4, message: String4 },
|
|
17525
|
+
payload: { id: String4, message: String4, request: optional2(String4) },
|
|
17371
17526
|
success: Struct({ id: String4 }),
|
|
17372
|
-
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession])
|
|
17527
|
+
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession, ...LINE_ERRORS])
|
|
17373
17528
|
}))), scoped4(admitted(make25("Interrupt", {
|
|
17374
17529
|
payload: { id: String4 },
|
|
17375
17530
|
success: Struct({ id: String4, message: String4 }),
|
|
17376
|
-
error: Union2([
|
|
17531
|
+
error: Union2([
|
|
17532
|
+
Forbidden2,
|
|
17533
|
+
NoSuchSession,
|
|
17534
|
+
AmbiguousSession,
|
|
17535
|
+
SessionBusy,
|
|
17536
|
+
RuntimeUnreachable,
|
|
17537
|
+
NoRuntime,
|
|
17538
|
+
...LINE_ERRORS
|
|
17539
|
+
])
|
|
17377
17540
|
}))), scoped4(admitted(make25("Remove", {
|
|
17378
17541
|
payload: { id: String4, keepWorktree: optional2(Boolean3) },
|
|
17379
17542
|
success: NullOr(RemoveOutcome),
|
|
17380
|
-
error: Union2([
|
|
17543
|
+
error: Union2([
|
|
17544
|
+
Forbidden2,
|
|
17545
|
+
NoSuchSession,
|
|
17546
|
+
AmbiguousSession,
|
|
17547
|
+
SessionBusy,
|
|
17548
|
+
RuntimeUnreachable,
|
|
17549
|
+
NoRuntime,
|
|
17550
|
+
...LINE_ERRORS
|
|
17551
|
+
])
|
|
17381
17552
|
}))), scoped4(make25("List", {
|
|
17382
17553
|
payload: { stopped: optional2(Boolean3), all: optional2(Boolean3) },
|
|
17383
|
-
success: ArraySchema(SessionInfo),
|
|
17554
|
+
success: Struct({ sessions: ArraySchema(SessionInfo), machines: ArraySchema(ListedMachine) }),
|
|
17384
17555
|
error: Union2([Forbidden2])
|
|
17385
17556
|
})), scoped4(make25("Get", {
|
|
17386
17557
|
payload: { id: String4 },
|
|
17387
17558
|
success: SessionStatusInfo,
|
|
17388
|
-
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession])
|
|
17559
|
+
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession, ...LINE_ERRORS])
|
|
17389
17560
|
})), scoped4(make25("Peek", {
|
|
17390
17561
|
payload: { id: String4, lines: optional2(Number5) },
|
|
17391
|
-
success: Struct({
|
|
17392
|
-
|
|
17393
|
-
|
|
17394
|
-
|
|
17562
|
+
success: Struct({
|
|
17563
|
+
text: String4,
|
|
17564
|
+
terminal: optional2(String4),
|
|
17565
|
+
view: optional2(String4)
|
|
17566
|
+
}),
|
|
17567
|
+
error: Union2([Forbidden2, NoSuchSession, AmbiguousSession, NoRuntime, RuntimeUnreachable, ...LINE_ERRORS])
|
|
17568
|
+
})), 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", {
|
|
17569
|
+
payload: { id: String4, turn: Number5 },
|
|
17570
|
+
error: Union2([Forbidden2, NoSuchSession, RuntimeUnreachable])
|
|
17571
|
+
}))), protocol(admitted(make25("TurnEnd", {
|
|
17572
|
+
payload: { sessionId: String4, harness: String4, event: String4 }
|
|
17395
17573
|
}))), protocol(admitted(make25("Prompt", {
|
|
17396
|
-
payload: { sessionId: String4, harness:
|
|
17574
|
+
payload: { sessionId: String4, harness: String4, event: String4 }
|
|
17397
17575
|
}))), scoped4(admitted(make25("Project.CoordinatorSession", {
|
|
17398
17576
|
payload: {
|
|
17399
|
-
harness:
|
|
17577
|
+
harness: String4,
|
|
17400
17578
|
fresh: Boolean3,
|
|
17401
17579
|
terminal: String4,
|
|
17402
|
-
machine: optional2(RuntimeMachine),
|
|
17403
17580
|
runtime: optional2(String4),
|
|
17404
17581
|
provider: optional2(String4),
|
|
17405
17582
|
model: optional2(String4),
|
|
17406
17583
|
routing: optional2(Routing),
|
|
17407
|
-
pid: optional2(Number5)
|
|
17408
|
-
env: optional2(Record(String4, String4))
|
|
17584
|
+
pid: optional2(Number5)
|
|
17409
17585
|
},
|
|
17410
17586
|
success: Struct({
|
|
17411
17587
|
sessionId: String4,
|
|
17412
17588
|
harnessSessionId: NullOr(String4),
|
|
17413
17589
|
projectId: String4,
|
|
17414
|
-
runtime: optional2(String4)
|
|
17590
|
+
runtime: optional2(String4),
|
|
17591
|
+
command: Struct({
|
|
17592
|
+
file: String4,
|
|
17593
|
+
args: ArraySchema(String4),
|
|
17594
|
+
env: Record(String4, String4)
|
|
17595
|
+
})
|
|
17415
17596
|
}),
|
|
17416
17597
|
error: Union2([
|
|
17417
17598
|
InvalidCaller,
|
|
@@ -17419,17 +17600,19 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17419
17600
|
NotInRepository,
|
|
17420
17601
|
ProjectMoved,
|
|
17421
17602
|
RuntimeUnreachable,
|
|
17422
|
-
RuntimeIncompatible
|
|
17603
|
+
RuntimeIncompatible,
|
|
17604
|
+
HarnessUnavailable,
|
|
17605
|
+
LaunchFailed
|
|
17423
17606
|
])
|
|
17424
17607
|
}))), scoped4(make25("Project.StartMain", {
|
|
17425
17608
|
payload: {
|
|
17426
|
-
harness: optional2(
|
|
17609
|
+
harness: optional2(String4),
|
|
17427
17610
|
provider: optional2(String4),
|
|
17428
17611
|
model: optional2(String4),
|
|
17429
17612
|
runtime: optional2(String4)
|
|
17430
17613
|
},
|
|
17431
17614
|
success: Struct({
|
|
17432
|
-
harness:
|
|
17615
|
+
harness: String4,
|
|
17433
17616
|
provider: optional2(String4),
|
|
17434
17617
|
model: optional2(String4),
|
|
17435
17618
|
runtime: String4,
|
|
@@ -17443,7 +17626,8 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17443
17626
|
NoHarnessChosen,
|
|
17444
17627
|
AgentRefused,
|
|
17445
17628
|
HarnessUnavailable,
|
|
17446
|
-
NoRuntime
|
|
17629
|
+
NoRuntime,
|
|
17630
|
+
LaunchFailed
|
|
17447
17631
|
])
|
|
17448
17632
|
})), scoped4(make25("Project.Open", {
|
|
17449
17633
|
payload: { move: optional2(Boolean3) },
|
|
@@ -17458,10 +17642,34 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17458
17642
|
candidates: optional2(ArraySchema(String4))
|
|
17459
17643
|
}),
|
|
17460
17644
|
error: Union2([Forbidden2, NotInRepository, ProjectMoved])
|
|
17645
|
+
})), scoped4(make25("Project.MainPlace", {
|
|
17646
|
+
payload: {
|
|
17647
|
+
callerEnv: Record(String4, String4),
|
|
17648
|
+
runtime: optional2(String4)
|
|
17649
|
+
},
|
|
17650
|
+
success: Struct({
|
|
17651
|
+
directory: String4,
|
|
17652
|
+
place: Union2([
|
|
17653
|
+
Struct({
|
|
17654
|
+
in: Literals(["terminal"]),
|
|
17655
|
+
runtime: String4,
|
|
17656
|
+
terminal: String4
|
|
17657
|
+
}),
|
|
17658
|
+
Struct({
|
|
17659
|
+
in: Literals(["launch"]),
|
|
17660
|
+
runtime: String4
|
|
17661
|
+
})
|
|
17662
|
+
])
|
|
17663
|
+
}),
|
|
17664
|
+
error: Union2([InvalidCaller, Forbidden2, NotInRepository, ProjectMoved, LaunchFailed])
|
|
17665
|
+
})), scoped4(make25("Project.FocusCoordinator", {
|
|
17666
|
+
payload: {},
|
|
17667
|
+
success: NullOr(Struct({ place: String4, focused: Boolean3 })),
|
|
17668
|
+
error: Union2([Forbidden2, NotInRepository, ProjectMoved])
|
|
17461
17669
|
})), scoped4(make25("Project.RunningCoordinator", {
|
|
17462
|
-
payload: { terminal: String4
|
|
17670
|
+
payload: { terminal: String4 },
|
|
17463
17671
|
success: NullOr(Struct({
|
|
17464
|
-
harness:
|
|
17672
|
+
harness: String4,
|
|
17465
17673
|
place: String4,
|
|
17466
17674
|
runtime: String4,
|
|
17467
17675
|
address: String4
|
|
@@ -17482,7 +17690,7 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17482
17690
|
}),
|
|
17483
17691
|
error: Union2([Forbidden2, NotInRepository, ProjectMoved, RuntimeUnreachable, NoRuntime, InvalidCaller])
|
|
17484
17692
|
}))), protocol(admitted(make25("CoordinatorSessionReady", {
|
|
17485
|
-
payload: { sessionId: String4, harness:
|
|
17693
|
+
payload: { sessionId: String4, harness: String4, harnessSessionId: String4 }
|
|
17486
17694
|
}))), scoped4(make25("Project.Info", {
|
|
17487
17695
|
success: ProjectInfoResult,
|
|
17488
17696
|
error: Union2([Forbidden2, NotInRepository, ProjectMoved])
|
|
@@ -17490,7 +17698,21 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17490
17698
|
payload: ProjectSearchInput.fields,
|
|
17491
17699
|
success: ArraySchema(String4),
|
|
17492
17700
|
error: Union2([Forbidden2, NotInRepository, ProjectMoved])
|
|
17493
|
-
})), scoped4(make25("
|
|
17701
|
+
})), scoped4(admitted(make25("Project.Create", {
|
|
17702
|
+
payload: { directory: String4, from: ArraySchema(String4) },
|
|
17703
|
+
success: Struct({
|
|
17704
|
+
directory: String4,
|
|
17705
|
+
folders: ArraySchema(Struct({
|
|
17706
|
+
name: String4,
|
|
17707
|
+
source: String4,
|
|
17708
|
+
path: String4,
|
|
17709
|
+
branch: String4,
|
|
17710
|
+
origin: optional2(String4),
|
|
17711
|
+
uncommitted: ArraySchema(String4)
|
|
17712
|
+
}))
|
|
17713
|
+
}),
|
|
17714
|
+
error: Union2([Forbidden2, ProjectCreateFailed])
|
|
17715
|
+
}))), scoped4(make25("Daemon.Stop", {
|
|
17494
17716
|
payload: { instance: String4 },
|
|
17495
17717
|
success: Struct({ instance: String4 }),
|
|
17496
17718
|
error: Union2([Forbidden2, WrongInstance, DaemonBusy, DaemonStopping])
|
|
@@ -17498,18 +17720,6 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17498
17720
|
payload: { instance: String4, command: ArraySchema(String4) },
|
|
17499
17721
|
success: Struct({ instance: String4 }),
|
|
17500
17722
|
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
17723
|
})), scoped4(make25("Session.Ready", {
|
|
17514
17724
|
payload: { id: String4, pid: optional2(Number5) },
|
|
17515
17725
|
error: Union2([Forbidden2, NoSuchSession])
|
|
@@ -17517,7 +17727,7 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17517
17727
|
success: ArraySchema(Struct({
|
|
17518
17728
|
id: String4,
|
|
17519
17729
|
agent: String4,
|
|
17520
|
-
harness:
|
|
17730
|
+
harness: String4,
|
|
17521
17731
|
integration: NullOr(String4),
|
|
17522
17732
|
working: Boolean3,
|
|
17523
17733
|
blocked: NullOr(String4)
|
|
@@ -17526,8 +17736,117 @@ class VibestRpcs extends make27(make25("Ping", { success: PingResult }), scoped4
|
|
|
17526
17736
|
})), scoped4(make25("Agents.Restart", {
|
|
17527
17737
|
payload: { ids: ArraySchema(String4), after: optional2(Number5) },
|
|
17528
17738
|
error: Forbidden2
|
|
17739
|
+
})), scoped4(make25("Peer.Hello", {
|
|
17740
|
+
payload: { id: String4, name: String4, callsMe: String4 },
|
|
17741
|
+
success: Struct({
|
|
17742
|
+
id: String4,
|
|
17743
|
+
name: String4,
|
|
17744
|
+
version: String4,
|
|
17745
|
+
runtimes: optional2(ArraySchema(RuntimeThere))
|
|
17746
|
+
}),
|
|
17747
|
+
error: Forbidden2
|
|
17748
|
+
})), scoped4(admitted(make25("Peer.Spawn", {
|
|
17749
|
+
payload: {
|
|
17750
|
+
repository: String4,
|
|
17751
|
+
identity: optional2(String4),
|
|
17752
|
+
commit: String4,
|
|
17753
|
+
prompt: String4,
|
|
17754
|
+
harness: optional2(String4),
|
|
17755
|
+
provider: optional2(String4),
|
|
17756
|
+
model: optional2(String4),
|
|
17757
|
+
title: optional2(String4),
|
|
17758
|
+
runtime: optional2(String4),
|
|
17759
|
+
parent: optional2(String4),
|
|
17760
|
+
reportTo: optional2(String4),
|
|
17761
|
+
request: String4
|
|
17762
|
+
},
|
|
17763
|
+
success: Struct({
|
|
17764
|
+
session: String4,
|
|
17765
|
+
harness: String4,
|
|
17766
|
+
provider: optional2(String4),
|
|
17767
|
+
model: optional2(String4),
|
|
17768
|
+
directory: String4,
|
|
17769
|
+
...Routing.fields
|
|
17770
|
+
}),
|
|
17771
|
+
error: Union2([
|
|
17772
|
+
InvalidCaller,
|
|
17773
|
+
Forbidden2,
|
|
17774
|
+
NoProject,
|
|
17775
|
+
NoCommit,
|
|
17776
|
+
PromptTooLarge,
|
|
17777
|
+
LimitReached,
|
|
17778
|
+
AllocationFailed,
|
|
17779
|
+
HarnessUnavailable,
|
|
17780
|
+
NoHarnessChosen,
|
|
17781
|
+
NoRuntime,
|
|
17782
|
+
AgentRefused,
|
|
17783
|
+
NoSuchSession,
|
|
17784
|
+
RuntimeUnreachable,
|
|
17785
|
+
RuntimeIncompatible
|
|
17786
|
+
])
|
|
17787
|
+
}))), scoped4(make25("Peer.Outbox", { success: OutboxItem, error: Forbidden2, stream: true })), scoped4(make25("Peer.Ack", { payload: { ids: ArraySchema(String4) }, error: Forbidden2 })), scoped4(make25("Machine.Add", {
|
|
17788
|
+
payload: { name: String4, target: String4 },
|
|
17789
|
+
success: Struct({
|
|
17790
|
+
name: String4,
|
|
17791
|
+
id: String4,
|
|
17792
|
+
vibestd: String4,
|
|
17793
|
+
version: String4,
|
|
17794
|
+
notes: ArraySchema(MachineNote)
|
|
17795
|
+
}),
|
|
17796
|
+
error: Union2([Forbidden2, MachineFailed, MachineIncompatible, AlreadyAdded])
|
|
17797
|
+
})), scoped4(make25("Machine.List", { success: ArraySchema(MachineInfo), error: Forbidden2 })), scoped4(make25("Machine.Remove", {
|
|
17798
|
+
payload: { name: String4 },
|
|
17799
|
+
success: Struct({ notes: ArraySchema(MachineNote) }),
|
|
17800
|
+
error: Union2([Forbidden2, UnknownMachine])
|
|
17529
17801
|
}))) {
|
|
17530
17802
|
}
|
|
17803
|
+
var ACCESS = {
|
|
17804
|
+
Ping: ["open", "peer"],
|
|
17805
|
+
Plugins: "open",
|
|
17806
|
+
"Harnesses.List": "open",
|
|
17807
|
+
"Integration.Guard": "open",
|
|
17808
|
+
"Runtimes.Doctor": "open",
|
|
17809
|
+
Subscriptions: "open",
|
|
17810
|
+
Republish: "open",
|
|
17811
|
+
TurnEnd: "open",
|
|
17812
|
+
Prompt: "open",
|
|
17813
|
+
CoordinatorSessionReady: "open",
|
|
17814
|
+
Report: "session",
|
|
17815
|
+
Spawn: "agent",
|
|
17816
|
+
Launch: "agent",
|
|
17817
|
+
List: ["agent", "peer"],
|
|
17818
|
+
Get: ["agent", "peer"],
|
|
17819
|
+
"Inbox.Subscribe": "coordinator",
|
|
17820
|
+
Watch: "cli",
|
|
17821
|
+
"Session.Seen": "cli",
|
|
17822
|
+
"Project.Open": "cli",
|
|
17823
|
+
"Project.MainPlace": "cli",
|
|
17824
|
+
"Project.CoordinatorSession": "agent",
|
|
17825
|
+
"Project.StartMain": "agent",
|
|
17826
|
+
"Project.FocusCoordinator": "cli",
|
|
17827
|
+
"Project.RunningCoordinator": "agent",
|
|
17828
|
+
"Project.StopCoordinator": "agent",
|
|
17829
|
+
"Project.Create": "cli",
|
|
17830
|
+
"Project.Info": "agent",
|
|
17831
|
+
"Project.Search": "agent",
|
|
17832
|
+
Send: ["owner", "peer"],
|
|
17833
|
+
Interrupt: ["owner", "peer"],
|
|
17834
|
+
Peek: ["owner", "peer"],
|
|
17835
|
+
Remove: ["owner", "peer"],
|
|
17836
|
+
"Daemon.Stop": "cli",
|
|
17837
|
+
"Daemon.Handoff": "cli",
|
|
17838
|
+
"Session.Ready": "self",
|
|
17839
|
+
"Agents.Outdated": "cli",
|
|
17840
|
+
"Agents.Restart": "cli",
|
|
17841
|
+
"Peer.Hello": "peer",
|
|
17842
|
+
"Peer.Spawn": "peer",
|
|
17843
|
+
"Peer.Outbox": "peer",
|
|
17844
|
+
"Peer.Ack": "peer",
|
|
17845
|
+
"Machine.Add": "cli",
|
|
17846
|
+
"Machine.List": "cli",
|
|
17847
|
+
"Machine.Remove": "cli"
|
|
17848
|
+
};
|
|
17849
|
+
var PEER_CALLS = new Set(Object.entries(ACCESS).filter(([, access]) => [].concat(access).includes("peer")).map(([method]) => method));
|
|
17531
17850
|
|
|
17532
17851
|
// ../../schema/src/layout.ts
|
|
17533
17852
|
class Layout extends Service()("vibest/Layout") {
|
|
@@ -17539,6 +17858,7 @@ class Layout extends Service()("vibest/Layout") {
|
|
|
17539
17858
|
socket: path.join(home, "vibest.sock"),
|
|
17540
17859
|
httpSocket: path.join(home, "vibest-http.sock"),
|
|
17541
17860
|
daemonInfo: path.join(home, "vibestd.pid"),
|
|
17861
|
+
identity: path.join(home, "identity.json"),
|
|
17542
17862
|
worktrees: path.join(home, "worktrees"),
|
|
17543
17863
|
projects: path.join(home, "projects"),
|
|
17544
17864
|
config: path.join(home, "vibest.json"),
|
|
@@ -17584,13 +17904,17 @@ class IncompatibleDaemon extends TaggedError3()("IncompatibleDaemon", {
|
|
|
17584
17904
|
daemonVersion: String4,
|
|
17585
17905
|
daemonProtocol: NullOr(Number5),
|
|
17586
17906
|
daemon: DaemonIdentity,
|
|
17587
|
-
client: Struct({ version: String4, command: ArraySchema(String4) })
|
|
17907
|
+
client: Struct({ version: String4, command: ArraySchema(String4) }),
|
|
17908
|
+
missing: optional2(String4)
|
|
17588
17909
|
}) {
|
|
17589
17910
|
get message() {
|
|
17590
17911
|
const got = this.daemonProtocol === null ? "no protocol" : `protocol ${this.daemonProtocol}`;
|
|
17591
17912
|
const self = `vibest ${this.client.version} (${this.client.command.map(shellQuote).join(" ")})`;
|
|
17913
|
+
const byHand = stopByHand(this.socket, this.daemon.pid).replace(/^To replace it, /, "");
|
|
17914
|
+
if (this.missing !== undefined)
|
|
17915
|
+
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}.`;
|
|
17592
17916
|
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: ${
|
|
17917
|
+
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
17918
|
}
|
|
17595
17919
|
}
|
|
17596
17920
|
var protocolHeaders = () => ({ [PROTOCOL_HEADER]: String(PROTOCOL) });
|
|
@@ -17633,21 +17957,25 @@ var hookCall = (socket, headers, send) => {
|
|
|
17633
17957
|
return gen2(function* () {
|
|
17634
17958
|
const first = yield* once;
|
|
17635
17959
|
if (isSuccess3(first) || !exists(findErrorOption2(first.cause), notConnected))
|
|
17636
|
-
return;
|
|
17960
|
+
return first;
|
|
17637
17961
|
yield* sleep2(HOOK_RETRY_DELAY);
|
|
17638
|
-
yield* once;
|
|
17962
|
+
return yield* once;
|
|
17639
17963
|
});
|
|
17640
17964
|
};
|
|
17641
|
-
var readPing = (socket) => connect2(socket).pipe(flatMap4((client) => client.Ping(undefined)), timeout2("1 second"), option2, scoped2);
|
|
17965
|
+
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
17966
|
var probe = (socket) => readPing(socket).pipe(map6(isSome2), orElseSucceed2(() => false));
|
|
17643
17967
|
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
|
-
}
|
|
17968
|
+
var incompatibleDaemon = (socket, ping, self, needs) => {
|
|
17969
|
+
const lacks = needs !== undefined && ping.capabilities?.[needs.capability] !== true;
|
|
17970
|
+
return ping.protocol === PROTOCOL && !lacks ? undefined : new IncompatibleDaemon({
|
|
17971
|
+
socket,
|
|
17972
|
+
daemonVersion: ping.version,
|
|
17973
|
+
daemonProtocol: ping.protocol ?? null,
|
|
17974
|
+
daemon: { pid: ping.pid, instance: ping.instance, command: ping.command, startedAt: ping.startedAt },
|
|
17975
|
+
client: { version: VERSION, command: self },
|
|
17976
|
+
...ping.protocol === PROTOCOL && needs !== undefined ? { missing: needs.method } : {}
|
|
17977
|
+
});
|
|
17978
|
+
};
|
|
17651
17979
|
var spawnDaemon = (command, args = [], env) => gen2(function* () {
|
|
17652
17980
|
const layout = yield* Layout;
|
|
17653
17981
|
const path = yield* Path;
|
|
@@ -17665,7 +17993,8 @@ var spawnDaemon = (command, args = [], env) => gen2(function* () {
|
|
|
17665
17993
|
...args
|
|
17666
17994
|
], {
|
|
17667
17995
|
detached: true,
|
|
17668
|
-
|
|
17996
|
+
env,
|
|
17997
|
+
extendEnv: true,
|
|
17669
17998
|
stdin: "ignore",
|
|
17670
17999
|
stdout: "ignore",
|
|
17671
18000
|
stderr: "ignore"
|
|
@@ -17708,421 +18037,11 @@ var withVibest = (claim, f, options) => gen2(function* () {
|
|
|
17708
18037
|
socket: layout.socket,
|
|
17709
18038
|
message: `vibestd did not answer Ping on ${layout.socket}`
|
|
17710
18039
|
});
|
|
17711
|
-
const incompatible = incompatibleDaemon(layout.socket, ping, yield* VibestCommand);
|
|
18040
|
+
const incompatible = incompatibleDaemon(layout.socket, ping, yield* VibestCommand, options?.needs);
|
|
17712
18041
|
if (incompatible)
|
|
17713
18042
|
return yield* incompatible;
|
|
17714
|
-
return yield* withHeaders(connect2(layout.socket).pipe(flatMap4((client) => f(client))), yield* claimHeaders(claim));
|
|
18043
|
+
return yield* withHeaders(connect2(layout.socket).pipe(flatMap4((client) => f(client, ping))), yield* claimHeaders(claim));
|
|
17715
18044
|
}).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
18045
|
|
|
18127
18046
|
// src/pi.ts
|
|
18128
18047
|
class Pi extends Service()("@vibest/pi/Pi") {
|
|
@@ -18977,9 +18896,22 @@ function compactUserMessages(pi) {
|
|
|
18977
18896
|
// src/extension.ts
|
|
18978
18897
|
var skillsDir = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "skills");
|
|
18979
18898
|
var encodeJson = encodeSync(fromJsonString2(Unknown2));
|
|
18980
|
-
var
|
|
18899
|
+
var COORDINATOR = "coordinator";
|
|
18900
|
+
var guarded = (agent, sessionId) => gen2(function* () {
|
|
18981
18901
|
const pi = yield* Pi;
|
|
18982
|
-
|
|
18902
|
+
const layout = yield* Layout;
|
|
18903
|
+
yield* pi.handle("tool_call", (e, ctx) => gen2(function* () {
|
|
18904
|
+
const headers = yield* claimHeaders(sessionId ? { _tag: "session", sessionId, pluginVersion: VERSION } : { _tag: "cli", repositoryRoot: ctx.cwd });
|
|
18905
|
+
const input = encodeJson({ tool_name: e.toolName, tool_input: e.input, cwd: ctx.cwd });
|
|
18906
|
+
const exit = yield* hookCall(layout.socket, headers, (client) => client["Integration.Guard"]({ harness: "pi", agent, input }));
|
|
18907
|
+
if (isFailure3(exit))
|
|
18908
|
+
return {
|
|
18909
|
+
block: true,
|
|
18910
|
+
reason: `vibest could not check this tool call (${pretty(exit.cause)}); it is refused.`
|
|
18911
|
+
};
|
|
18912
|
+
const reason = exit.value.answer;
|
|
18913
|
+
return typeof reason === "string" && reason ? { block: true, reason } : undefined;
|
|
18914
|
+
}));
|
|
18983
18915
|
});
|
|
18984
18916
|
var lastReply = (messages) => {
|
|
18985
18917
|
const message = messages.findLast((m) => m.role === "assistant");
|
|
@@ -18992,7 +18924,7 @@ var piHeaders = (sessionId, ctx) => claimHeaders({
|
|
|
18992
18924
|
harnessSessionId: ctx.sessionManager.getSessionId(),
|
|
18993
18925
|
pluginVersion: VERSION
|
|
18994
18926
|
});
|
|
18995
|
-
var
|
|
18927
|
+
var session = (sessionId) => effectDiscard(gen2(function* () {
|
|
18996
18928
|
const pi = yield* Pi;
|
|
18997
18929
|
const layout = yield* Layout;
|
|
18998
18930
|
const root = yield* make24(false);
|
|
@@ -19005,13 +18937,11 @@ var session2 = (sessionId) => effectDiscard(gen2(function* () {
|
|
|
19005
18937
|
const headers = yield* piHeaders(sessionId, ctx);
|
|
19006
18938
|
const event = encodeJson({ type: "input", text: e.text, source: e.source });
|
|
19007
18939
|
yield* hookCall(layout.socket, headers, (client) => client.Prompt({ sessionId, harness: "pi", event }));
|
|
19008
|
-
yield* writeTerminalStatus("working");
|
|
19009
18940
|
}));
|
|
19010
18941
|
yield* pi.handle("agent_settled", (e, ctx) => gen2(function* () {
|
|
19011
18942
|
if (!(yield* get2(root)) || !ctx.isIdle())
|
|
19012
18943
|
return;
|
|
19013
18944
|
const { text, error } = yield* get2(reply);
|
|
19014
|
-
yield* writeTerminalStatus("idle");
|
|
19015
18945
|
const headers = yield* piHeaders(sessionId, ctx);
|
|
19016
18946
|
const event = encodeJson({ type: "agent_settled", text, error, aborted: e.aborted });
|
|
19017
18947
|
yield* hookCall(layout.socket, headers, (client) => client.TurnEnd({ sessionId, harness: "pi", event }));
|
|
@@ -19032,7 +18962,7 @@ var reportSession = fn2("reportSession")(function* (sessionId) {
|
|
|
19032
18962
|
yield* pi.handle("session_start", (event, ctx) => event.reason === "new" || event.reason === "resume" || event.reason === "fork" ? send(ctx) : void_3);
|
|
19033
18963
|
yield* pi.handle("agent_end", (_event, ctx) => send(ctx));
|
|
19034
18964
|
});
|
|
19035
|
-
var
|
|
18965
|
+
var coordinator = effectDiscard(gen2(function* () {
|
|
19036
18966
|
const pi = yield* Pi;
|
|
19037
18967
|
yield* pi.handle("resources_discover", () => succeed7({ skillPaths: [skillsDir] }));
|
|
19038
18968
|
yield* pi.handle("before_agent_start", (e) => sync2(() => {
|
|
@@ -19059,18 +18989,22 @@ var coordinator2 = effectDiscard(gen2(function* () {
|
|
|
19059
18989
|
}));
|
|
19060
18990
|
var ready = (sessionId) => effectDiscard(gen2(function* () {
|
|
19061
18991
|
const pi = yield* Pi;
|
|
19062
|
-
|
|
18992
|
+
const scope = yield* scope2;
|
|
18993
|
+
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({
|
|
18994
|
+
while: (e) => e._tag === "DaemonUnavailable" || e._tag === "RpcClientError" || e._tag === "TimeoutError",
|
|
18995
|
+
schedule: spaced("1 second")
|
|
18996
|
+
}), ignore2, forkIn2(scope), asVoid2));
|
|
19063
18997
|
}));
|
|
19064
18998
|
var extension2 = unwrap(gen2(function* () {
|
|
19065
18999
|
const agent = getOrUndefined(yield* option3(String5("VIBEST_AGENT")));
|
|
19066
19000
|
if (!agent)
|
|
19067
19001
|
return empty4;
|
|
19068
|
-
const guarding = effectDiscard(guarded(rulesOf(agent)));
|
|
19069
19002
|
const sessionId = getOrUndefined(yield* option3(String5("VIBEST_SESSION_ID")));
|
|
19003
|
+
const guarding = effectDiscard(guarded(agent, sessionId));
|
|
19070
19004
|
const guard = sessionId ? merge2(guarding, ready(sessionId)) : guarding;
|
|
19071
19005
|
if (agent === COORDINATOR)
|
|
19072
|
-
return
|
|
19073
|
-
return sessionId ?
|
|
19006
|
+
return coordinator.pipe(provideMerge(guard));
|
|
19007
|
+
return sessionId ? session(sessionId).pipe(provideMerge(guard)) : guard;
|
|
19074
19008
|
}));
|
|
19075
19009
|
var vibestCommand = effect(VibestCommand, schema(fromJsonString2(ArraySchema(String4)), "VIBEST_COMMAND").pipe(withDefault3(["vibest"])));
|
|
19076
19010
|
var services = mergeAll2(Layout.layer, layer.pipe(provide2(layer2)), layer2, succeed6(SocketConnector, (endpoint) => makeNet({ path: endpoint })), vibestCommand).pipe(provideMerge(layer3));
|