@pellux/goodvibes-agent 1.0.5 → 1.0.7
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/CHANGELOG.md +10 -0
- package/README.md +3 -3
- package/dist/package/main.js +352 -228
- package/docs/README.md +2 -2
- package/docs/connected-host.md +2 -0
- package/docs/getting-started.md +2 -2
- package/docs/tools-and-commands.md +2 -2
- package/package.json +1 -1
- package/src/tools/agent-harness-connected-host-status.ts +146 -0
- package/src/tools/agent-harness-metadata.ts +1 -0
- package/src/tools/agent-harness-tool-schema.ts +1 -1
- package/src/tools/agent-harness-tool.ts +3 -0
- package/src/version.ts +1 -1
package/dist/package/main.js
CHANGED
|
@@ -816566,7 +816566,7 @@ var createStyledCell = (char, overrides = {}) => ({
|
|
|
816566
816566
|
// src/version.ts
|
|
816567
816567
|
import { readFileSync } from "fs";
|
|
816568
816568
|
import { join } from "path";
|
|
816569
|
-
var _version = "1.0.
|
|
816569
|
+
var _version = "1.0.7";
|
|
816570
816570
|
var _sdkVersion = "0.33.35";
|
|
816571
816571
|
try {
|
|
816572
816572
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, "..", "package.json"), "utf-8"));
|
|
@@ -821197,7 +821197,7 @@ var INBOUND_EVENT_SURFACE_KINDS = new Set([
|
|
|
821197
821197
|
]);
|
|
821198
821198
|
// src/runtime/onboarding/apply.ts
|
|
821199
821199
|
init_config8();
|
|
821200
|
-
import { existsSync as
|
|
821200
|
+
import { existsSync as existsSync86, readFileSync as readFileSync92, rmSync as rmSync10 } from "fs";
|
|
821201
821201
|
|
|
821202
821202
|
// src/agent/runtime-profile.ts
|
|
821203
821203
|
import { existsSync as existsSync43, mkdirSync as mkdirSync32, readFileSync as readFileSync48, readdirSync as readdirSync15, rmSync as rmSync5, statSync as statSync13, writeFileSync as writeFileSync29 } from "fs";
|
|
@@ -847775,13 +847775,13 @@ init_state3();
|
|
|
847775
847775
|
|
|
847776
847776
|
// src/input/commands/recall-shared.ts
|
|
847777
847777
|
var VALID_CLASSES = ["decision", "constraint", "incident", "pattern", "fact", "risk", "runbook", "architecture", "ownership"];
|
|
847778
|
-
var
|
|
847778
|
+
var VALID_SCOPES = ["session", "project", "team"];
|
|
847779
847779
|
var VALID_REVIEW_STATES = ["fresh", "reviewed", "stale", "contradicted"];
|
|
847780
847780
|
function isValidClass(s4) {
|
|
847781
847781
|
return VALID_CLASSES.includes(s4);
|
|
847782
847782
|
}
|
|
847783
847783
|
function isValidScope(s4) {
|
|
847784
|
-
return
|
|
847784
|
+
return VALID_SCOPES.includes(s4);
|
|
847785
847785
|
}
|
|
847786
847786
|
function isValidReviewState(s4) {
|
|
847787
847787
|
return VALID_REVIEW_STATES.includes(s4);
|
|
@@ -847824,7 +847824,7 @@ function handleRecallSearch(args2, context) {
|
|
|
847824
847824
|
if (isValidScope(scope))
|
|
847825
847825
|
filter.scope = scope;
|
|
847826
847826
|
else {
|
|
847827
|
-
context.print(`[memory] Unknown scope "${scope}". Valid values ${
|
|
847827
|
+
context.print(`[memory] Unknown scope "${scope}". Valid values ${VALID_SCOPES.join(", ")}.`);
|
|
847828
847828
|
return;
|
|
847829
847829
|
}
|
|
847830
847830
|
}
|
|
@@ -847999,7 +847999,7 @@ function handleRecallList(args2, context) {
|
|
|
847999
847999
|
if (scopeIdx !== -1 && args2[scopeIdx + 1]) {
|
|
848000
848000
|
const scope = args2[scopeIdx + 1];
|
|
848001
848001
|
if (!isValidScope(scope)) {
|
|
848002
|
-
context.print(`[memory] Unknown scope "${scope}". Valid values ${
|
|
848002
|
+
context.print(`[memory] Unknown scope "${scope}". Valid values ${VALID_SCOPES.join(", ")}.`);
|
|
848003
848003
|
return;
|
|
848004
848004
|
}
|
|
848005
848005
|
filter.scope = scope;
|
|
@@ -848049,7 +848049,7 @@ async function handleRecallAdd(args2, context) {
|
|
|
848049
848049
|
const tags = tagsRaw ? tagsRaw.split(",").map((token) => token.trim()).filter(Boolean) : [];
|
|
848050
848050
|
const scope = scopeRaw && isValidScope(scopeRaw) ? scopeRaw : "project";
|
|
848051
848051
|
if (scopeRaw && !isValidScope(scopeRaw)) {
|
|
848052
|
-
context.print(`[memory] Invalid scope "${scopeRaw}". Valid values ${
|
|
848052
|
+
context.print(`[memory] Invalid scope "${scopeRaw}". Valid values ${VALID_SCOPES.join(", ")}.`);
|
|
848053
848053
|
return;
|
|
848054
848054
|
}
|
|
848055
848055
|
const provenance = [];
|
|
@@ -848183,7 +848183,7 @@ function handleRecallExport(args2, context) {
|
|
|
848183
848183
|
if (scopeIdx !== -1 && commandArgs[scopeIdx + 1]) {
|
|
848184
848184
|
const scope = commandArgs[scopeIdx + 1];
|
|
848185
848185
|
if (!isValidScope(scope)) {
|
|
848186
|
-
context.print(`[memory] Unknown scope "${scope}". Valid values ${
|
|
848186
|
+
context.print(`[memory] Unknown scope "${scope}". Valid values ${VALID_SCOPES.join(", ")}.`);
|
|
848187
848187
|
return;
|
|
848188
848188
|
}
|
|
848189
848189
|
filter.scope = scope;
|
|
@@ -848262,7 +848262,7 @@ function handleRecallHandoffExport(args2, context) {
|
|
|
848262
848262
|
const scopeIdx = commandArgs.indexOf("--scope");
|
|
848263
848263
|
const scopeRaw = scopeIdx !== -1 ? commandArgs[scopeIdx + 1] : "team";
|
|
848264
848264
|
if (!scopeRaw || !isValidScope(scopeRaw)) {
|
|
848265
|
-
context.print(`[memory] Unknown scope "${scopeRaw ?? ""}". Valid values ${
|
|
848265
|
+
context.print(`[memory] Unknown scope "${scopeRaw ?? ""}". Valid values ${VALID_SCOPES.join(", ")}.`);
|
|
848266
848266
|
return;
|
|
848267
848267
|
}
|
|
848268
848268
|
const bundle = memory.exportBundle({ scope: scopeRaw });
|
|
@@ -848378,7 +848378,7 @@ function handleRecallPromote(args2, context) {
|
|
|
848378
848378
|
const id = parsed.rest[0];
|
|
848379
848379
|
const scope = parsed.rest[1];
|
|
848380
848380
|
if (!id || !scope || !isValidScope(scope)) {
|
|
848381
|
-
context.print(`[memory] Usage: /memory promote <id> <${
|
|
848381
|
+
context.print(`[memory] Usage: /memory promote <id> <${VALID_SCOPES.join("|")}> --yes`);
|
|
848382
848382
|
return;
|
|
848383
848383
|
}
|
|
848384
848384
|
if (!parsed.yes) {
|
|
@@ -862154,7 +862154,7 @@ import { mkdirSync as mkdirSync64, readFileSync as readFileSync86, writeFileSync
|
|
|
862154
862154
|
import { dirname as dirname63, resolve as resolve39 } from "path";
|
|
862155
862155
|
init_state3();
|
|
862156
862156
|
var VALID_CLASSES2 = ["decision", "constraint", "incident", "pattern", "fact", "risk", "runbook", "architecture", "ownership"];
|
|
862157
|
-
var
|
|
862157
|
+
var VALID_SCOPES3 = ["session", "project", "team"];
|
|
862158
862158
|
var VALID_REVIEW_STATES3 = ["fresh", "reviewed", "stale", "contradicted"];
|
|
862159
862159
|
var VALID_PROVENANCE_KINDS = ["session", "turn", "task", "event", "file"];
|
|
862160
862160
|
var VALUE_OPTIONS = new Set([
|
|
@@ -862254,7 +862254,7 @@ function isMemoryClass2(value) {
|
|
|
862254
862254
|
return VALID_CLASSES2.includes(value);
|
|
862255
862255
|
}
|
|
862256
862256
|
function isMemoryScope2(value) {
|
|
862257
|
-
return
|
|
862257
|
+
return VALID_SCOPES3.includes(value);
|
|
862258
862258
|
}
|
|
862259
862259
|
function isReviewState(value) {
|
|
862260
862260
|
return VALID_REVIEW_STATES3.includes(value);
|
|
@@ -862269,7 +862269,7 @@ function requireClass(value) {
|
|
|
862269
862269
|
}
|
|
862270
862270
|
function requireScope(value) {
|
|
862271
862271
|
if (!value || !isMemoryScope2(value))
|
|
862272
|
-
throw new Error(`Invalid memory scope "${value ?? ""}". Valid values ${
|
|
862272
|
+
throw new Error(`Invalid memory scope "${value ?? ""}". Valid values ${VALID_SCOPES3.join(", ")}`);
|
|
862273
862273
|
return value;
|
|
862274
862274
|
}
|
|
862275
862275
|
function optionalScope(value) {
|
|
@@ -879549,6 +879549,7 @@ function connectedHostSummary(context, toolRegistry) {
|
|
|
879549
879549
|
tokenPath: connection5.tokenPath,
|
|
879550
879550
|
ownership: "external-connected-host",
|
|
879551
879551
|
lifecycle: "GoodVibes Agent can use public connected-host operator routes, but does not start, stop, restart, install, expose, or mutate the host listener.",
|
|
879552
|
+
statusMode: 'Use agent_harness mode:"connected_host_status" for live read-only reachability, SDK compatibility, token posture, and Agent Knowledge route readiness.',
|
|
879552
879553
|
routeFamilies: connectedHostRouteFamilies(),
|
|
879553
879554
|
capabilities: connectedHostCapabilityMap(toolRegistry),
|
|
879554
879555
|
blockedCapabilities: blockedConnectedHostCapabilities()
|
|
@@ -880062,6 +880063,274 @@ function openHarnessPanel(context, args2) {
|
|
|
880062
880063
|
};
|
|
880063
880064
|
}
|
|
880064
880065
|
|
|
880066
|
+
// src/cli/external-runtime.ts
|
|
880067
|
+
import { existsSync as existsSync83, readFileSync as readFileSync90 } from "fs";
|
|
880068
|
+
import { join as join98 } from "path";
|
|
880069
|
+
function isRecord42(value) {
|
|
880070
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
880071
|
+
}
|
|
880072
|
+
function readString53(record2, key) {
|
|
880073
|
+
const value = record2?.[key];
|
|
880074
|
+
return typeof value === "string" ? value : null;
|
|
880075
|
+
}
|
|
880076
|
+
function resolveBaseUrl2(configManager) {
|
|
880077
|
+
const host = String(configManager.get("controlPlane.host") ?? "127.0.0.1");
|
|
880078
|
+
const port = Number(configManager.get("controlPlane.port") ?? 3421);
|
|
880079
|
+
return `http://${host}:${Number.isFinite(port) ? port : 3421}`;
|
|
880080
|
+
}
|
|
880081
|
+
function readOperatorToken2(homeDirectory) {
|
|
880082
|
+
const path7 = join98(homeDirectory, ".goodvibes", "daemon", "operator-tokens.json");
|
|
880083
|
+
if (!existsSync83(path7))
|
|
880084
|
+
return { token: null, path: path7 };
|
|
880085
|
+
try {
|
|
880086
|
+
const parsed = JSON.parse(readFileSync90(path7, "utf-8"));
|
|
880087
|
+
const token = isRecord42(parsed) && typeof parsed.token === "string" ? parsed.token : null;
|
|
880088
|
+
return { token, path: path7 };
|
|
880089
|
+
} catch {
|
|
880090
|
+
return { token: null, path: path7 };
|
|
880091
|
+
}
|
|
880092
|
+
}
|
|
880093
|
+
async function fetchJson2(url2, token, timeoutMs) {
|
|
880094
|
+
const controller = new AbortController;
|
|
880095
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
880096
|
+
try {
|
|
880097
|
+
const response5 = await fetch(url2, {
|
|
880098
|
+
headers: token ? { authorization: `Bearer ${token}` } : undefined,
|
|
880099
|
+
signal: controller.signal
|
|
880100
|
+
});
|
|
880101
|
+
const text = await response5.text();
|
|
880102
|
+
let body2 = text;
|
|
880103
|
+
if (text.trim().length > 0) {
|
|
880104
|
+
try {
|
|
880105
|
+
body2 = JSON.parse(text);
|
|
880106
|
+
} catch {
|
|
880107
|
+
body2 = text;
|
|
880108
|
+
}
|
|
880109
|
+
}
|
|
880110
|
+
return { ok: response5.ok, status: response5.status, body: body2 };
|
|
880111
|
+
} finally {
|
|
880112
|
+
clearTimeout(timer);
|
|
880113
|
+
}
|
|
880114
|
+
}
|
|
880115
|
+
async function inspectCliExternalRuntime(options) {
|
|
880116
|
+
const baseUrl = resolveBaseUrl2(options.configManager);
|
|
880117
|
+
const token = readOperatorToken2(options.homeDirectory);
|
|
880118
|
+
const timeoutMs = options.timeoutMs ?? 1500;
|
|
880119
|
+
const route = "/api/goodvibes-agent/knowledge/status";
|
|
880120
|
+
try {
|
|
880121
|
+
const status = await fetchJson2(`${baseUrl}/status`, token.token, timeoutMs);
|
|
880122
|
+
const statusRecord = isRecord42(status.body) ? status.body : {};
|
|
880123
|
+
const version6 = readString53(statusRecord, "version") ?? "unknown";
|
|
880124
|
+
const compatible = status.ok && version6 === SDK_VERSION;
|
|
880125
|
+
if (!status.ok) {
|
|
880126
|
+
return {
|
|
880127
|
+
baseUrl,
|
|
880128
|
+
statusCode: status.status,
|
|
880129
|
+
reachable: false,
|
|
880130
|
+
version: version6,
|
|
880131
|
+
expectedVersion: SDK_VERSION,
|
|
880132
|
+
compatible: false,
|
|
880133
|
+
operatorToken: { present: Boolean(token.token), path: token.path },
|
|
880134
|
+
agentKnowledge: {
|
|
880135
|
+
route,
|
|
880136
|
+
ready: false,
|
|
880137
|
+
kind: status.status === 401 ? "auth_required" : "connected_host_unavailable",
|
|
880138
|
+
statusCode: status.status
|
|
880139
|
+
},
|
|
880140
|
+
error: typeof status.body === "string" ? status.body : `HTTP ${status.status}`
|
|
880141
|
+
};
|
|
880142
|
+
}
|
|
880143
|
+
if (!token.token) {
|
|
880144
|
+
return {
|
|
880145
|
+
baseUrl,
|
|
880146
|
+
statusCode: status.status,
|
|
880147
|
+
reachable: true,
|
|
880148
|
+
version: version6,
|
|
880149
|
+
expectedVersion: SDK_VERSION,
|
|
880150
|
+
compatible,
|
|
880151
|
+
operatorToken: { present: false, path: token.path },
|
|
880152
|
+
agentKnowledge: {
|
|
880153
|
+
route,
|
|
880154
|
+
ready: false,
|
|
880155
|
+
kind: "auth_required",
|
|
880156
|
+
statusCode: null
|
|
880157
|
+
},
|
|
880158
|
+
error: null
|
|
880159
|
+
};
|
|
880160
|
+
}
|
|
880161
|
+
if (!compatible) {
|
|
880162
|
+
return {
|
|
880163
|
+
baseUrl,
|
|
880164
|
+
statusCode: status.status,
|
|
880165
|
+
reachable: true,
|
|
880166
|
+
version: version6,
|
|
880167
|
+
expectedVersion: SDK_VERSION,
|
|
880168
|
+
compatible: false,
|
|
880169
|
+
operatorToken: { present: true, path: token.path },
|
|
880170
|
+
agentKnowledge: {
|
|
880171
|
+
route,
|
|
880172
|
+
ready: false,
|
|
880173
|
+
kind: "version_mismatch",
|
|
880174
|
+
statusCode: null
|
|
880175
|
+
},
|
|
880176
|
+
error: null
|
|
880177
|
+
};
|
|
880178
|
+
}
|
|
880179
|
+
const knowledge2 = await fetchJson2(`${baseUrl}${route}`, token.token, timeoutMs);
|
|
880180
|
+
return {
|
|
880181
|
+
baseUrl,
|
|
880182
|
+
statusCode: status.status,
|
|
880183
|
+
reachable: true,
|
|
880184
|
+
version: version6,
|
|
880185
|
+
expectedVersion: SDK_VERSION,
|
|
880186
|
+
compatible,
|
|
880187
|
+
operatorToken: { present: true, path: token.path },
|
|
880188
|
+
agentKnowledge: {
|
|
880189
|
+
route,
|
|
880190
|
+
ready: knowledge2.ok,
|
|
880191
|
+
kind: knowledge2.ok ? "ok" : knowledge2.status === 401 ? "auth_required" : knowledge2.status === 404 ? "connected_host_route_unavailable" : "connected_host_error",
|
|
880192
|
+
statusCode: knowledge2.status
|
|
880193
|
+
},
|
|
880194
|
+
error: knowledge2.ok ? null : typeof knowledge2.body === "string" ? knowledge2.body : `HTTP ${knowledge2.status}`
|
|
880195
|
+
};
|
|
880196
|
+
} catch (error51) {
|
|
880197
|
+
return {
|
|
880198
|
+
baseUrl,
|
|
880199
|
+
statusCode: null,
|
|
880200
|
+
reachable: false,
|
|
880201
|
+
version: "unknown",
|
|
880202
|
+
expectedVersion: SDK_VERSION,
|
|
880203
|
+
compatible: false,
|
|
880204
|
+
operatorToken: { present: Boolean(token.token), path: token.path },
|
|
880205
|
+
agentKnowledge: {
|
|
880206
|
+
route,
|
|
880207
|
+
ready: false,
|
|
880208
|
+
kind: "connected_host_unavailable",
|
|
880209
|
+
statusCode: null
|
|
880210
|
+
},
|
|
880211
|
+
error: summarizeError(error51)
|
|
880212
|
+
};
|
|
880213
|
+
}
|
|
880214
|
+
}
|
|
880215
|
+
|
|
880216
|
+
// src/tools/agent-harness-connected-host-status.ts
|
|
880217
|
+
var CONNECTED_HOST_STATUS_TIMEOUT_MS = 1500;
|
|
880218
|
+
function resolveHomeDirectory(context) {
|
|
880219
|
+
return context.workspace.shellPaths?.homeDirectory ?? context.platform.configManager.getHomeDirectory() ?? "";
|
|
880220
|
+
}
|
|
880221
|
+
function resolveWorkingDirectory(context) {
|
|
880222
|
+
return context.workspace.shellPaths?.workingDirectory ?? context.platform.configManager.getWorkingDirectory() ?? "";
|
|
880223
|
+
}
|
|
880224
|
+
function connectedHostFindings(runtime3, tokenUsable) {
|
|
880225
|
+
const findings = [];
|
|
880226
|
+
if (!runtime3.reachable) {
|
|
880227
|
+
findings.push({
|
|
880228
|
+
id: "connected-host-unreachable",
|
|
880229
|
+
severity: "warning",
|
|
880230
|
+
summary: "Connected host is not reachable.",
|
|
880231
|
+
cause: runtime3.error ?? `No response from ${runtime3.baseUrl}.`,
|
|
880232
|
+
action: "Start or repair the owning GoodVibes host outside Agent, then recheck connected-host status."
|
|
880233
|
+
});
|
|
880234
|
+
} else if (!runtime3.compatible) {
|
|
880235
|
+
findings.push({
|
|
880236
|
+
id: "connected-host-version-mismatch",
|
|
880237
|
+
severity: "warning",
|
|
880238
|
+
summary: "Connected host SDK version does not match Agent.",
|
|
880239
|
+
cause: `Connected host reports SDK ${runtime3.version}; Agent expects ${runtime3.expectedVersion}.`,
|
|
880240
|
+
action: "Update the owning GoodVibes host so its /status route reports the Agent SDK pin."
|
|
880241
|
+
});
|
|
880242
|
+
}
|
|
880243
|
+
if (!tokenUsable) {
|
|
880244
|
+
findings.push({
|
|
880245
|
+
id: "connected-host-token-missing",
|
|
880246
|
+
severity: "warning",
|
|
880247
|
+
summary: "Connected-host operator token is missing or unreadable.",
|
|
880248
|
+
cause: `No usable operator token was found at ${runtime3.operatorToken.path}.`,
|
|
880249
|
+
action: "Provision or repair connected-host access through the owning GoodVibes host."
|
|
880250
|
+
});
|
|
880251
|
+
}
|
|
880252
|
+
if (runtime3.reachable && tokenUsable && !runtime3.agentKnowledge.ready) {
|
|
880253
|
+
findings.push({
|
|
880254
|
+
id: "agent-knowledge-route-not-ready",
|
|
880255
|
+
severity: "warning",
|
|
880256
|
+
summary: "Isolated Agent Knowledge route is not ready.",
|
|
880257
|
+
cause: `${runtime3.agentKnowledge.route} returned ${runtime3.agentKnowledge.kind}${runtime3.agentKnowledge.statusCode === null ? "" : ` (${runtime3.agentKnowledge.statusCode})`}.`,
|
|
880258
|
+
action: "Update or repair the connected host, then recheck Agent Knowledge compatibility."
|
|
880259
|
+
});
|
|
880260
|
+
}
|
|
880261
|
+
return findings;
|
|
880262
|
+
}
|
|
880263
|
+
async function connectedHostStatusSummary(context, toolRegistry) {
|
|
880264
|
+
const homeDirectory = resolveHomeDirectory(context);
|
|
880265
|
+
const workingDirectory = resolveWorkingDirectory(context);
|
|
880266
|
+
const token = readConnectedHostOperatorToken(homeDirectory);
|
|
880267
|
+
const runtime3 = await inspectCliExternalRuntime({
|
|
880268
|
+
configManager: context.platform.configManager,
|
|
880269
|
+
homeDirectory,
|
|
880270
|
+
timeoutMs: CONNECTED_HOST_STATUS_TIMEOUT_MS
|
|
880271
|
+
});
|
|
880272
|
+
const tokenUsable = Boolean(token.token);
|
|
880273
|
+
return {
|
|
880274
|
+
ownership: "external-connected-host",
|
|
880275
|
+
readOnly: true,
|
|
880276
|
+
timeoutMs: CONNECTED_HOST_STATUS_TIMEOUT_MS,
|
|
880277
|
+
lifecycle: "GoodVibes Agent can inspect connected-host readiness and use public operator routes, but does not start, stop, restart, install, expose, or mutate the host listener.",
|
|
880278
|
+
paths: {
|
|
880279
|
+
workingDirectory,
|
|
880280
|
+
homeDirectory
|
|
880281
|
+
},
|
|
880282
|
+
endpoints: {
|
|
880283
|
+
controlPlane: {
|
|
880284
|
+
enabled: context.platform.configManager.get("controlPlane.enabled"),
|
|
880285
|
+
...resolveRuntimeEndpointBinding(context.platform.configManager, "controlPlane")
|
|
880286
|
+
},
|
|
880287
|
+
httpListener: {
|
|
880288
|
+
enabled: context.platform.configManager.get("danger.httpListener"),
|
|
880289
|
+
...resolveRuntimeEndpointBinding(context.platform.configManager, "httpListener")
|
|
880290
|
+
},
|
|
880291
|
+
web: {
|
|
880292
|
+
enabled: context.platform.configManager.get("web.enabled"),
|
|
880293
|
+
...resolveRuntimeEndpointBinding(context.platform.configManager, "web")
|
|
880294
|
+
}
|
|
880295
|
+
},
|
|
880296
|
+
operatorToken: {
|
|
880297
|
+
present: token.present,
|
|
880298
|
+
usable: tokenUsable,
|
|
880299
|
+
path: token.path,
|
|
880300
|
+
fingerprint: token.token ? `sha256:${connectedHostOperatorTokenFingerprint(token.token)}` : null,
|
|
880301
|
+
error: token.error ?? null
|
|
880302
|
+
},
|
|
880303
|
+
liveStatus: runtime3,
|
|
880304
|
+
routeReadiness: [
|
|
880305
|
+
{
|
|
880306
|
+
id: "status",
|
|
880307
|
+
route: "/status",
|
|
880308
|
+
reachable: runtime3.reachable,
|
|
880309
|
+
statusCode: runtime3.statusCode,
|
|
880310
|
+
sdkVersion: runtime3.version,
|
|
880311
|
+
expectedSdkVersion: runtime3.expectedVersion,
|
|
880312
|
+
compatible: runtime3.compatible
|
|
880313
|
+
},
|
|
880314
|
+
{
|
|
880315
|
+
id: "agent-knowledge",
|
|
880316
|
+
route: runtime3.agentKnowledge.route,
|
|
880317
|
+
ready: runtime3.agentKnowledge.ready,
|
|
880318
|
+
kind: runtime3.agentKnowledge.kind,
|
|
880319
|
+
statusCode: runtime3.agentKnowledge.statusCode
|
|
880320
|
+
}
|
|
880321
|
+
],
|
|
880322
|
+
findings: connectedHostFindings(runtime3, tokenUsable),
|
|
880323
|
+
modelAccess: {
|
|
880324
|
+
diagnostics: 'Use mode:"connected_host_status" for live read-only host readiness. Use mode:"connected_host" for capability and boundary inventory.',
|
|
880325
|
+
cliMirrors: ["goodvibes-agent status --json", "goodvibes-agent doctor", "goodvibes-agent compat"],
|
|
880326
|
+
tuiMirrors: ["Agent Workspace -> Home -> Host compatibility", "Agent Workspace -> Home -> Doctor diagnostics", "Agent Workspace -> Home -> Review health"]
|
|
880327
|
+
},
|
|
880328
|
+
routeFamilies: connectedHostRouteFamilies(),
|
|
880329
|
+
capabilities: connectedHostCapabilityMap(toolRegistry),
|
|
880330
|
+
blockedCapabilities: blockedConnectedHostCapabilities()
|
|
880331
|
+
};
|
|
880332
|
+
}
|
|
880333
|
+
|
|
880065
880334
|
// src/tools/agent-harness-local-operations.ts
|
|
880066
880335
|
function output6(value) {
|
|
880067
880336
|
return { success: true, output: typeof value === "string" ? value : JSON.stringify(value, null, 2) };
|
|
@@ -880069,7 +880338,7 @@ function output6(value) {
|
|
|
880069
880338
|
function error51(message) {
|
|
880070
880339
|
return { success: false, error: message };
|
|
880071
880340
|
}
|
|
880072
|
-
function
|
|
880341
|
+
function readString54(value) {
|
|
880073
880342
|
return typeof value === "string" ? value.trim() : "";
|
|
880074
880343
|
}
|
|
880075
880344
|
function readFieldMap2(value) {
|
|
@@ -880096,10 +880365,10 @@ function describeEditor(editor) {
|
|
|
880096
880365
|
}
|
|
880097
880366
|
function readRecordId(args2) {
|
|
880098
880367
|
const fields = readFieldMap2(args2.fields);
|
|
880099
|
-
return
|
|
880368
|
+
return readString54(args2.recordId ?? args2.id ?? fields.recordId ?? fields.id);
|
|
880100
880369
|
}
|
|
880101
880370
|
function requireConfirmed(args2, label) {
|
|
880102
|
-
if (!
|
|
880371
|
+
if (!readString54(args2.explicitUserRequest))
|
|
880103
880372
|
return `${label} requires explicitUserRequest with the user's exact request or a short faithful summary.`;
|
|
880104
880373
|
if (args2.confirm !== true)
|
|
880105
880374
|
return `${label} requires confirm:true after an explicit user request.`;
|
|
@@ -880227,7 +880496,7 @@ function localRegistryArgsForTarget(target, args2, recordId) {
|
|
|
880227
880496
|
...base2,
|
|
880228
880497
|
...edit,
|
|
880229
880498
|
...target.action === "stale" && fields.reason ? { reason: fields.reason } : {},
|
|
880230
|
-
...target.action === "delete" ? { confirm: args2.confirm, explicitUserRequest:
|
|
880499
|
+
...target.action === "delete" ? { confirm: args2.confirm, explicitUserRequest: readString54(args2.explicitUserRequest) } : {}
|
|
880231
880500
|
};
|
|
880232
880501
|
}
|
|
880233
880502
|
async function executeTool(toolRegistry, name51, toolArgs) {
|
|
@@ -880272,7 +880541,7 @@ async function runLocalWorkspaceAction(deps, action2, args2) {
|
|
|
880272
880541
|
if (missing.length > 0)
|
|
880273
880542
|
return output6({ status: "missing_required_fields", missing, action: action2.id, editor: describeEditor(editor) });
|
|
880274
880543
|
if (editor.kind === "knowledge-url")
|
|
880275
|
-
return executeTool(deps.toolRegistry, "agent_knowledge_ingest", { sourceKind: "url", url: fieldReader(editor, fields)("url"), tags: splitList5(fieldReader(editor, fields)("tags")), folderPath: fieldReader(editor, fields)("folder"), confirm: args2.confirm, explicitUserRequest:
|
|
880544
|
+
return executeTool(deps.toolRegistry, "agent_knowledge_ingest", { sourceKind: "url", url: fieldReader(editor, fields)("url"), tags: splitList5(fieldReader(editor, fields)("tags")), folderPath: fieldReader(editor, fields)("folder"), confirm: args2.confirm, explicitUserRequest: readString54(args2.explicitUserRequest) });
|
|
880276
880545
|
return executeTool(deps.toolRegistry, "agent_local_registry", localRegistryArgsFromEditor(editor, fields, recordId));
|
|
880277
880546
|
}
|
|
880278
880547
|
if (!target)
|
|
@@ -880281,7 +880550,7 @@ async function runLocalWorkspaceAction(deps, action2, args2) {
|
|
|
880281
880550
|
}
|
|
880282
880551
|
|
|
880283
880552
|
// src/tools/agent-harness-model-tool-catalog.ts
|
|
880284
|
-
function
|
|
880553
|
+
function readString55(value) {
|
|
880285
880554
|
return typeof value === "string" ? value.trim() : "";
|
|
880286
880555
|
}
|
|
880287
880556
|
function readLimit8(value, fallback) {
|
|
@@ -880291,7 +880560,7 @@ function readLimit8(value, fallback) {
|
|
|
880291
880560
|
return Math.max(1, Math.min(500, Math.trunc(parsed)));
|
|
880292
880561
|
}
|
|
880293
880562
|
function listHarnessModelTools(toolRegistry, args2) {
|
|
880294
|
-
const query2 =
|
|
880563
|
+
const query2 = readString55(args2.query).toLowerCase();
|
|
880295
880564
|
const includeParameters = args2.includeParameters === true;
|
|
880296
880565
|
const limit3 = readLimit8(args2.limit, 200);
|
|
880297
880566
|
return toolRegistry.getToolDefinitions().filter((tool2) => !query2 || [tool2.name, tool2.description, ...tool2.sideEffects ?? []].join(`
|
|
@@ -880335,7 +880604,8 @@ var AGENT_HARNESS_MODES = [
|
|
|
880335
880604
|
"workspace_action",
|
|
880336
880605
|
"run_workspace_action",
|
|
880337
880606
|
"tools",
|
|
880338
|
-
"connected_host"
|
|
880607
|
+
"connected_host",
|
|
880608
|
+
"connected_host_status"
|
|
880339
880609
|
];
|
|
880340
880610
|
var KEY_COMBO_PARAMETER_SCHEMA = {
|
|
880341
880611
|
type: "object",
|
|
@@ -880456,7 +880726,7 @@ var AGENT_HARNESS_PARAMETER_PROPERTIES = {
|
|
|
880456
880726
|
};
|
|
880457
880727
|
|
|
880458
880728
|
// src/tools/agent-harness-ui-surface-metadata.ts
|
|
880459
|
-
function
|
|
880729
|
+
function readString56(value) {
|
|
880460
880730
|
return typeof value === "string" ? value.trim() : "";
|
|
880461
880731
|
}
|
|
880462
880732
|
function readLimit9(value, fallback) {
|
|
@@ -880482,18 +880752,18 @@ function opened(surface, extra = {}) {
|
|
|
880482
880752
|
};
|
|
880483
880753
|
}
|
|
880484
880754
|
function optionalModelTarget(args2) {
|
|
880485
|
-
const target =
|
|
880755
|
+
const target = readString56(args2.target);
|
|
880486
880756
|
return target === "main" || target === "helper" || target === "tool" || target === "tts" ? target : undefined;
|
|
880487
880757
|
}
|
|
880488
880758
|
function optionalOnboardingMode(args2) {
|
|
880489
|
-
const target =
|
|
880759
|
+
const target = readString56(args2.target);
|
|
880490
880760
|
return target === "new" || target === "edit" || target === "reopen" ? target : undefined;
|
|
880491
880761
|
}
|
|
880492
880762
|
function workspaceCategory(args2) {
|
|
880493
|
-
return
|
|
880763
|
+
return readString56(args2.categoryId || args2.category || args2.target) || undefined;
|
|
880494
880764
|
}
|
|
880495
880765
|
function settingsTarget(args2) {
|
|
880496
|
-
return
|
|
880766
|
+
return readString56(args2.target || args2.key || args2.prefix) || undefined;
|
|
880497
880767
|
}
|
|
880498
880768
|
var UI_SURFACES = [
|
|
880499
880769
|
{
|
|
@@ -880744,19 +881014,19 @@ function totalHarnessUiSurfaces() {
|
|
|
880744
881014
|
return UI_SURFACES.length;
|
|
880745
881015
|
}
|
|
880746
881016
|
function listHarnessUiSurfaces(context, args2) {
|
|
880747
|
-
const query2 =
|
|
881017
|
+
const query2 = readString56(args2.query);
|
|
880748
881018
|
const limit3 = readLimit9(args2.limit, 200);
|
|
880749
881019
|
return UI_SURFACES.map((surface) => describeSurface(context, surface)).filter((surface) => surfaceMatches(surface, query2)).slice(0, limit3);
|
|
880750
881020
|
}
|
|
880751
881021
|
function describeHarnessUiSurface(context, args2) {
|
|
880752
|
-
const surfaceId =
|
|
881022
|
+
const surfaceId = readString56(args2.surfaceId || args2.query);
|
|
880753
881023
|
if (!surfaceId)
|
|
880754
881024
|
return null;
|
|
880755
881025
|
const surface = UI_SURFACES.find((entry) => entry.id === surfaceId || entry.label.toLowerCase() === surfaceId.toLowerCase());
|
|
880756
881026
|
return surface ? describeSurface(context, surface) : null;
|
|
880757
881027
|
}
|
|
880758
881028
|
function openHarnessUiSurface(context, args2) {
|
|
880759
|
-
const surfaceId =
|
|
881029
|
+
const surfaceId = readString56(args2.surfaceId || args2.query);
|
|
880760
881030
|
const surface = UI_SURFACES.find((entry) => entry.id === surfaceId || entry.label.toLowerCase() === surfaceId.toLowerCase());
|
|
880761
881031
|
if (!surface) {
|
|
880762
881032
|
return {
|
|
@@ -880775,7 +881045,7 @@ function openHarnessUiSurface(context, args2) {
|
|
|
880775
881045
|
function isMode(value) {
|
|
880776
881046
|
return typeof value === "string" && AGENT_HARNESS_MODES.includes(value);
|
|
880777
881047
|
}
|
|
880778
|
-
function
|
|
881048
|
+
function readString57(value) {
|
|
880779
881049
|
return typeof value === "string" ? value.trim() : "";
|
|
880780
881050
|
}
|
|
880781
881051
|
function readLimit10(value, fallback) {
|
|
@@ -880859,7 +881129,7 @@ function describeWorkspaceEditor(editor) {
|
|
|
880859
881129
|
}
|
|
880860
881130
|
function selectedRoutineFromArgs(snapshot, args2) {
|
|
880861
881131
|
const fields = readFieldMap3(args2.fields);
|
|
880862
|
-
const routineId =
|
|
881132
|
+
const routineId = readString57(args2.recordId) || readString57(fields.routineId) || readString57(fields.id);
|
|
880863
881133
|
if (!routineId)
|
|
880864
881134
|
return null;
|
|
880865
881135
|
return snapshot.localRoutines.find((routine) => routine.id === routineId || routine.name.toLowerCase() === routineId.toLowerCase()) ?? null;
|
|
@@ -880927,8 +881197,8 @@ function localEditorModelExecution(editorKind) {
|
|
|
880927
881197
|
return "Use the command field, editor schema, or a first-class Agent model tool when available.";
|
|
880928
881198
|
}
|
|
880929
881199
|
function listWorkspaceActions(deps, args2) {
|
|
880930
|
-
const query2 =
|
|
880931
|
-
const categoryId =
|
|
881200
|
+
const query2 = readString57(args2.query);
|
|
881201
|
+
const categoryId = readString57(args2.categoryId || args2.category);
|
|
880932
881202
|
const limit3 = readLimit10(args2.limit, 200);
|
|
880933
881203
|
const includeEditor = args2.includeParameters === true;
|
|
880934
881204
|
const editorContext = includeEditor ? buildWorkspaceEditorContext(deps.commandContext, args2) : null;
|
|
@@ -880936,8 +881206,8 @@ function listWorkspaceActions(deps, args2) {
|
|
|
880936
881206
|
return source.filter((entry) => !categoryId || entry.category.id === categoryId).slice(0, limit3).map((entry) => describeWorkspaceAction(entry.category, entry.action, { includeEditor, editorContext }));
|
|
880937
881207
|
}
|
|
880938
881208
|
function findWorkspaceAction(args2) {
|
|
880939
|
-
const actionId =
|
|
880940
|
-
const categoryId =
|
|
881209
|
+
const actionId = readString57(args2.actionId || args2.query);
|
|
881210
|
+
const categoryId = readString57(args2.categoryId || args2.category);
|
|
880941
881211
|
if (!actionId)
|
|
880942
881212
|
return null;
|
|
880943
881213
|
return allWorkspaceActions().find((entry) => {
|
|
@@ -880947,12 +881217,12 @@ function findWorkspaceAction(args2) {
|
|
|
880947
881217
|
}) ?? null;
|
|
880948
881218
|
}
|
|
880949
881219
|
function listCommands(commandRegistry, args2) {
|
|
880950
|
-
const query2 =
|
|
881220
|
+
const query2 = readString57(args2.query);
|
|
880951
881221
|
const limit3 = readLimit10(args2.limit, 200);
|
|
880952
881222
|
return commandRegistry.list().filter((command8) => commandMatches(command8, query2)).sort((a4, b3) => a4.name.localeCompare(b3.name)).slice(0, limit3).map(describeCommand);
|
|
880953
881223
|
}
|
|
880954
881224
|
function requireConfirmedAction(args2, action2) {
|
|
880955
|
-
const explicitUserRequest =
|
|
881225
|
+
const explicitUserRequest = readString57(args2.explicitUserRequest);
|
|
880956
881226
|
if (!explicitUserRequest)
|
|
880957
881227
|
return `${action2} requires explicitUserRequest with the user's exact request or a short faithful summary.`;
|
|
880958
881228
|
if (args2.confirm !== true)
|
|
@@ -880960,7 +881230,7 @@ function requireConfirmedAction(args2, action2) {
|
|
|
880960
881230
|
return null;
|
|
880961
881231
|
}
|
|
880962
881232
|
function commandFromArgs(args2) {
|
|
880963
|
-
const rawCommand =
|
|
881233
|
+
const rawCommand = readString57(args2.command);
|
|
880964
881234
|
if (rawCommand) {
|
|
880965
881235
|
const parsed = parseSlashCommand(rawCommand);
|
|
880966
881236
|
if (!parsed.name)
|
|
@@ -880970,7 +881240,7 @@ function commandFromArgs(args2) {
|
|
|
880970
881240
|
args: parsed.args
|
|
880971
881241
|
};
|
|
880972
881242
|
}
|
|
880973
|
-
const commandName =
|
|
881243
|
+
const commandName = readString57(args2.commandName).replace(/^\//, "");
|
|
880974
881244
|
if (!commandName)
|
|
880975
881245
|
return null;
|
|
880976
881246
|
const commandArgs = readStringArray12(args2.args);
|
|
@@ -881198,7 +881468,8 @@ function createAgentHarnessTool(deps) {
|
|
|
881198
881468
|
workspace: 'Use mode:"workspace_actions" to list and mode:"workspace_action" for editor schemas; set includeParameters:true on workspace_actions to inline editor schemas.',
|
|
881199
881469
|
settings: 'Use mode:"settings", mode:"get_setting", mode:"set_setting", and mode:"reset_setting".',
|
|
881200
881470
|
tools: 'Use mode:"tools" with includeParameters:true to inspect first-class model tool schemas.',
|
|
881201
|
-
connectedHost: 'Use mode:"connected_host" for the connected-host capability map and blocked boundaries.'
|
|
881471
|
+
connectedHost: 'Use mode:"connected_host" for the connected-host capability map and blocked boundaries.',
|
|
881472
|
+
connectedHostStatus: 'Use mode:"connected_host_status" for live read-only host reachability, SDK compatibility, token posture, and Agent Knowledge route readiness.'
|
|
881202
881473
|
},
|
|
881203
881474
|
settingsPolicy: settingsPolicySummary(),
|
|
881204
881475
|
connectedHost: connectedHostSummary(deps.commandContext, deps.toolRegistry)
|
|
@@ -881228,7 +881499,7 @@ function createAgentHarnessTool(deps) {
|
|
|
881228
881499
|
}
|
|
881229
881500
|
if (args2.mode === "panel") {
|
|
881230
881501
|
const panel = describeHarnessPanel(deps.commandContext, args2);
|
|
881231
|
-
return panel ? output7(panel) : error52(`Unknown panel ${
|
|
881502
|
+
return panel ? output7(panel) : error52(`Unknown panel ${readString57(args2.panelId || args2.query) || "<missing>"}.`);
|
|
881232
881503
|
}
|
|
881233
881504
|
if (args2.mode === "open_panel") {
|
|
881234
881505
|
const confirmationError2 = requireConfirmedAction(args2, "Panel routing");
|
|
@@ -881242,7 +881513,7 @@ function createAgentHarnessTool(deps) {
|
|
|
881242
881513
|
}
|
|
881243
881514
|
if (args2.mode === "ui_surface") {
|
|
881244
881515
|
const surface = describeHarnessUiSurface(deps.commandContext, args2);
|
|
881245
|
-
return surface ? output7(surface) : error52(`Unknown UI surface ${
|
|
881516
|
+
return surface ? output7(surface) : error52(`Unknown UI surface ${readString57(args2.surfaceId || args2.query) || "<missing>"}.`);
|
|
881246
881517
|
}
|
|
881247
881518
|
if (args2.mode === "open_ui_surface") {
|
|
881248
881519
|
const confirmationError2 = requireConfirmedAction(args2, "UI surface routing");
|
|
@@ -881256,7 +881527,7 @@ function createAgentHarnessTool(deps) {
|
|
|
881256
881527
|
return output7(listHarnessKeybindings(deps.commandContext, args2));
|
|
881257
881528
|
if (args2.mode === "keybinding") {
|
|
881258
881529
|
const binding = describeHarnessKeybinding(deps.commandContext, args2);
|
|
881259
|
-
return binding ? output7(binding) : error52(`Unknown keybinding action ${
|
|
881530
|
+
return binding ? output7(binding) : error52(`Unknown keybinding action ${readString57(args2.actionId || args2.key || args2.query) || "<missing>"}.`);
|
|
881260
881531
|
}
|
|
881261
881532
|
if (args2.mode === "set_keybinding") {
|
|
881262
881533
|
const confirmationError2 = requireConfirmedAction(args2, "Keybinding mutation");
|
|
@@ -881275,7 +881546,7 @@ function createAgentHarnessTool(deps) {
|
|
|
881275
881546
|
return output7({ commands: commands3, returned: commands3.length, total: deps.commandRegistry.list().length });
|
|
881276
881547
|
}
|
|
881277
881548
|
if (args2.mode === "command") {
|
|
881278
|
-
const name51 =
|
|
881549
|
+
const name51 = readString57(args2.commandName).replace(/^\//, "");
|
|
881279
881550
|
const command8 = name51 ? deps.commandRegistry.get(name51) : null;
|
|
881280
881551
|
return command8 ? output7(describeCommand(command8)) : error52(`Unknown slash command /${name51 || "<missing>"}.`);
|
|
881281
881552
|
}
|
|
@@ -881283,16 +881554,16 @@ function createAgentHarnessTool(deps) {
|
|
|
881283
881554
|
return runCommand2(deps, args2);
|
|
881284
881555
|
if (args2.mode === "settings") {
|
|
881285
881556
|
const settings = listHarnessSettings(deps.commandContext.platform.configManager, {
|
|
881286
|
-
category:
|
|
881287
|
-
prefix:
|
|
881288
|
-
query:
|
|
881557
|
+
category: readString57(args2.category) || undefined,
|
|
881558
|
+
prefix: readString57(args2.prefix) || undefined,
|
|
881559
|
+
query: readString57(args2.query) || undefined,
|
|
881289
881560
|
includeHidden: args2.includeHidden === true,
|
|
881290
881561
|
limit: readLimit10(args2.limit, 100)
|
|
881291
881562
|
});
|
|
881292
881563
|
return output7({ settings, returned: settings.length, policy: settingsPolicySummary() });
|
|
881293
881564
|
}
|
|
881294
881565
|
if (args2.mode === "get_setting") {
|
|
881295
|
-
const key =
|
|
881566
|
+
const key = readString57(args2.key);
|
|
881296
881567
|
const setting = getHarnessSetting(deps.commandContext.platform.configManager, key);
|
|
881297
881568
|
return setting ? output7(setting) : error52(`Unknown setting ${key || "<missing>"}.`);
|
|
881298
881569
|
}
|
|
@@ -881302,7 +881573,7 @@ function createAgentHarnessTool(deps) {
|
|
|
881302
881573
|
return error52(confirmationError2);
|
|
881303
881574
|
if (args2.value === undefined)
|
|
881304
881575
|
return error52("set_setting requires value.");
|
|
881305
|
-
const key =
|
|
881576
|
+
const key = readString57(args2.key);
|
|
881306
881577
|
const result2 = await setHarnessSetting(deps.commandContext.platform.configManager, deps.commandContext.platform.secretsManager, key, args2.value);
|
|
881307
881578
|
return output7(result2);
|
|
881308
881579
|
}
|
|
@@ -881310,7 +881581,7 @@ function createAgentHarnessTool(deps) {
|
|
|
881310
881581
|
const confirmationError2 = requireConfirmedAction(args2, "Setting reset");
|
|
881311
881582
|
if (confirmationError2)
|
|
881312
881583
|
return error52(confirmationError2);
|
|
881313
|
-
const key =
|
|
881584
|
+
const key = readString57(args2.key);
|
|
881314
881585
|
const result2 = await resetHarnessSetting(deps.commandContext.platform.configManager, deps.commandContext.platform.secretsManager, key);
|
|
881315
881586
|
return output7(result2);
|
|
881316
881587
|
}
|
|
@@ -881327,7 +881598,7 @@ function createAgentHarnessTool(deps) {
|
|
|
881327
881598
|
if (args2.mode === "workspace_action") {
|
|
881328
881599
|
const found = findWorkspaceAction(args2);
|
|
881329
881600
|
const editorContext = buildWorkspaceEditorContext(deps.commandContext, args2);
|
|
881330
|
-
return found ? output7(describeWorkspaceAction(found.category, found.action, { includeEditor: true, editorContext })) : error52(`Unknown Agent workspace action ${
|
|
881601
|
+
return found ? output7(describeWorkspaceAction(found.category, found.action, { includeEditor: true, editorContext })) : error52(`Unknown Agent workspace action ${readString57(args2.actionId || args2.query) || "<missing>"}.`);
|
|
881331
881602
|
}
|
|
881332
881603
|
if (args2.mode === "run_workspace_action")
|
|
881333
881604
|
return runWorkspaceAction(deps, args2);
|
|
@@ -881337,6 +881608,8 @@ function createAgentHarnessTool(deps) {
|
|
|
881337
881608
|
}
|
|
881338
881609
|
if (args2.mode === "connected_host")
|
|
881339
881610
|
return output7(connectedHostSummary(deps.commandContext, deps.toolRegistry));
|
|
881611
|
+
if (args2.mode === "connected_host_status")
|
|
881612
|
+
return output7(await connectedHostStatusSummary(deps.commandContext, deps.toolRegistry));
|
|
881340
881613
|
return error52(`Unhandled agent_harness mode: ${args2.mode}`);
|
|
881341
881614
|
} catch (err2) {
|
|
881342
881615
|
return error52(formatHarnessError(err2));
|
|
@@ -883113,7 +883386,7 @@ var MAX_INPUT_LENGTH2 = exports_security2.MAX_INPUT_LENGTH;
|
|
|
883113
883386
|
var MAX_TOKEN_COUNT2 = exports_security2.MAX_TOKEN_COUNT;
|
|
883114
883387
|
|
|
883115
883388
|
// src/runtime/surface-feature-flags.ts
|
|
883116
|
-
function
|
|
883389
|
+
function isRecord43(value) {
|
|
883117
883390
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
883118
883391
|
}
|
|
883119
883392
|
function isFeatureFlagConfigKey(key) {
|
|
@@ -883130,7 +883403,7 @@ function readFeatureFlagConfigValue(config6, key) {
|
|
|
883130
883403
|
}
|
|
883131
883404
|
function mergeFeatureFlagConfigValue(config6, key, value) {
|
|
883132
883405
|
if (key === "featureFlags") {
|
|
883133
|
-
if (!
|
|
883406
|
+
if (!isRecord43(value))
|
|
883134
883407
|
throw new Error("featureFlags expects an object value.");
|
|
883135
883408
|
const patch2 = {};
|
|
883136
883409
|
for (const [flagId, state3] of Object.entries(value)) {
|
|
@@ -883150,8 +883423,8 @@ function mergeFeatureFlagConfigValue(config6, key, value) {
|
|
|
883150
883423
|
|
|
883151
883424
|
// src/runtime/onboarding/verify.ts
|
|
883152
883425
|
init_config8();
|
|
883153
|
-
import { existsSync as
|
|
883154
|
-
import { join as
|
|
883426
|
+
import { existsSync as existsSync84 } from "fs";
|
|
883427
|
+
import { join as join99 } from "path";
|
|
883155
883428
|
function getNow(deps) {
|
|
883156
883429
|
return deps.clock?.() ?? Date.now();
|
|
883157
883430
|
}
|
|
@@ -883232,7 +883505,7 @@ function verifyAuthOperation(_deps, operation) {
|
|
|
883232
883505
|
}
|
|
883233
883506
|
function verifyCreateAgentProfileOperation(deps, operation) {
|
|
883234
883507
|
const resolution2 = resolveAgentRuntimeProfileHome(deps.shellPaths.homeDirectory, operation.name);
|
|
883235
|
-
const ok3 =
|
|
883508
|
+
const ok3 = existsSync84(join99(resolution2.homeDirectory, "profile.json"));
|
|
883236
883509
|
return {
|
|
883237
883510
|
id: `agent-profile:${resolution2.id}`,
|
|
883238
883511
|
status: ok3 ? "pass" : "fail",
|
|
@@ -883330,15 +883603,15 @@ async function verifyOnboardingRequest(deps, request2) {
|
|
|
883330
883603
|
}
|
|
883331
883604
|
|
|
883332
883605
|
// src/runtime/onboarding/apply-file-helpers.ts
|
|
883333
|
-
import { existsSync as
|
|
883606
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync68, readFileSync as readFileSync91, unlinkSync as unlinkSync11, writeFileSync as writeFileSync59 } from "fs";
|
|
883334
883607
|
import { dirname as dirname67 } from "path";
|
|
883335
883608
|
function isPlainObject3(value) {
|
|
883336
883609
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
883337
883610
|
}
|
|
883338
883611
|
function readJsonObject(path7) {
|
|
883339
|
-
if (!
|
|
883612
|
+
if (!existsSync85(path7))
|
|
883340
883613
|
return {};
|
|
883341
|
-
const parsed = JSON.parse(
|
|
883614
|
+
const parsed = JSON.parse(readFileSync91(path7, "utf-8"));
|
|
883342
883615
|
if (!isPlainObject3(parsed))
|
|
883343
883616
|
throw new Error(`Expected an object JSON payload at ${path7}.`);
|
|
883344
883617
|
return parsed;
|
|
@@ -883366,7 +883639,7 @@ function setNestedValue(root, key, value) {
|
|
|
883366
883639
|
}
|
|
883367
883640
|
function restoreFile(path7, previous, reload) {
|
|
883368
883641
|
if (previous === null) {
|
|
883369
|
-
if (
|
|
883642
|
+
if (existsSync85(path7))
|
|
883370
883643
|
unlinkSync11(path7);
|
|
883371
883644
|
} else {
|
|
883372
883645
|
mkdirSync68(dirname67(path7), { recursive: true });
|
|
@@ -883375,7 +883648,7 @@ function restoreFile(path7, previous, reload) {
|
|
|
883375
883648
|
reload?.();
|
|
883376
883649
|
}
|
|
883377
883650
|
function snapshotFileRollback(path7, reload) {
|
|
883378
|
-
const previous =
|
|
883651
|
+
const previous = existsSync85(path7) ? readFileSync91(path7, "utf-8") : null;
|
|
883379
883652
|
return () => restoreFile(path7, previous, reload);
|
|
883380
883653
|
}
|
|
883381
883654
|
async function runRollbacks(rollbacks) {
|
|
@@ -883494,7 +883767,7 @@ function validateCreateAgentProfileOperation(deps, operation) {
|
|
|
883494
883767
|
if (name51.length === 0)
|
|
883495
883768
|
throw new Error("Agent profile name is required.");
|
|
883496
883769
|
const resolution2 = resolveAgentRuntimeProfileHome(deps.shellPaths.homeDirectory, name51);
|
|
883497
|
-
if (
|
|
883770
|
+
if (existsSync86(resolution2.homeDirectory)) {
|
|
883498
883771
|
throw new Error(`Agent profile already exists: ${resolution2.id}`);
|
|
883499
883772
|
}
|
|
883500
883773
|
const templateId = operation.templateId?.trim();
|
|
@@ -883506,7 +883779,7 @@ function validateSelectAgentProfileOperation(deps, operation) {
|
|
|
883506
883779
|
if (name51.length === 0)
|
|
883507
883780
|
throw new Error("Agent profile name is required.");
|
|
883508
883781
|
const resolution2 = resolveAgentRuntimeProfileHome(deps.shellPaths.homeDirectory, name51);
|
|
883509
|
-
if (!
|
|
883782
|
+
if (!existsSync86(resolution2.homeDirectory)) {
|
|
883510
883783
|
throw new Error(`Agent profile does not exist: ${resolution2.id}`);
|
|
883511
883784
|
}
|
|
883512
883785
|
}
|
|
@@ -883614,7 +883887,7 @@ async function buildSecretRollbackAction(deps, operation) {
|
|
|
883614
883887
|
throw new Error(`Secret storage locations for ${scope} scope are unavailable.`);
|
|
883615
883888
|
const snapshots = locations.map((location) => ({
|
|
883616
883889
|
path: location.path,
|
|
883617
|
-
previous:
|
|
883890
|
+
previous: existsSync86(location.path) ? readFileSync92(location.path, "utf-8") : null
|
|
883618
883891
|
}));
|
|
883619
883892
|
return () => {
|
|
883620
883893
|
for (const snapshot of snapshots)
|
|
@@ -883648,7 +883921,7 @@ async function buildRollbackAction(deps, operation) {
|
|
|
883648
883921
|
if (operation.kind === "create-agent-profile") {
|
|
883649
883922
|
const resolution2 = resolveAgentRuntimeProfileHome(deps.shellPaths.homeDirectory, operation.name);
|
|
883650
883923
|
return () => {
|
|
883651
|
-
if (
|
|
883924
|
+
if (existsSync86(resolution2.homeDirectory))
|
|
883652
883925
|
rmSync10(resolution2.homeDirectory, { recursive: true, force: true });
|
|
883653
883926
|
};
|
|
883654
883927
|
}
|
|
@@ -883984,7 +884257,7 @@ async function applyOnboardingRequest(deps, request2) {
|
|
|
883984
884257
|
};
|
|
883985
884258
|
}
|
|
883986
884259
|
// src/runtime/onboarding/markers.ts
|
|
883987
|
-
import { existsSync as
|
|
884260
|
+
import { existsSync as existsSync87, mkdirSync as mkdirSync69, readFileSync as readFileSync93, writeFileSync as writeFileSync60 } from "fs";
|
|
883988
884261
|
import { dirname as dirname68 } from "path";
|
|
883989
884262
|
var ONBOARDING_CHECK_MARKER_FILE = "onboarding-checked.json";
|
|
883990
884263
|
function resolveMarkerPath(shellPaths3, scope) {
|
|
@@ -884028,10 +884301,10 @@ function getOnboardingCheckMarkerPath(shellPaths3, scope = "user") {
|
|
|
884028
884301
|
}
|
|
884029
884302
|
function readOnboardingCheckMarker(shellPaths3, scope = "user") {
|
|
884030
884303
|
const path7 = resolveMarkerPath(shellPaths3, scope);
|
|
884031
|
-
if (!
|
|
884304
|
+
if (!existsSync87(path7))
|
|
884032
884305
|
return buildMissingMarkerState(scope, path7);
|
|
884033
884306
|
try {
|
|
884034
|
-
const parsed = JSON.parse(
|
|
884307
|
+
const parsed = JSON.parse(readFileSync93(path7, "utf-8"));
|
|
884035
884308
|
if (!isCheckMarkerPayload(parsed)) {
|
|
884036
884309
|
return buildParseErrorState(scope, path7, "Invalid onboarding check marker payload.");
|
|
884037
884310
|
}
|
|
@@ -884073,7 +884346,7 @@ function writeOnboardingCheckMarker(shellPaths3, options = {}) {
|
|
|
884073
884346
|
return readOnboardingCheckMarker(shellPaths3, scope);
|
|
884074
884347
|
}
|
|
884075
884348
|
// src/input/handler-content-actions.ts
|
|
884076
|
-
import { existsSync as
|
|
884349
|
+
import { existsSync as existsSync88, lstatSync as lstatSync3, readFileSync as readFileSync94, readdirSync as readdirSync22 } from "fs";
|
|
884077
884350
|
import { basename as basename6, relative as relative15 } from "path";
|
|
884078
884351
|
var MARKER_REGEX = /\[(TEXT|IMAGE): [^\]]+\]/g;
|
|
884079
884352
|
var IMAGE_PREFIXES = [
|
|
@@ -884133,7 +884406,7 @@ function readContextFileBlock(reference, projectRoot) {
|
|
|
884133
884406
|
logger.debug("expandPrompt: context reference rejected", { reference, error: summarizeError(error53) });
|
|
884134
884407
|
return null;
|
|
884135
884408
|
}
|
|
884136
|
-
if (!
|
|
884409
|
+
if (!existsSync88(resolvedPath3))
|
|
884137
884410
|
return null;
|
|
884138
884411
|
const stat6 = lstatSync3(resolvedPath3);
|
|
884139
884412
|
const label = escapeContextAttribute(relative15(projectRoot, resolvedPath3) || basename6(resolvedPath3));
|
|
@@ -884152,14 +884425,14 @@ function readContextFileBlock(reference, projectRoot) {
|
|
|
884152
884425
|
if (stat6.size > MAX_CONTEXT_FILE_BYTES) {
|
|
884153
884426
|
return [
|
|
884154
884427
|
`<context-file path="${label}" truncated="true" bytes="${stat6.size}">`,
|
|
884155
|
-
|
|
884428
|
+
readFileSync94(resolvedPath3, "utf-8").slice(0, MAX_CONTEXT_FILE_BYTES),
|
|
884156
884429
|
"</context-file>"
|
|
884157
884430
|
].join(`
|
|
884158
884431
|
`);
|
|
884159
884432
|
}
|
|
884160
884433
|
return [
|
|
884161
884434
|
`<context-file path="${label}" bytes="${stat6.size}">`,
|
|
884162
|
-
|
|
884435
|
+
readFileSync94(resolvedPath3, "utf-8"),
|
|
884163
884436
|
"</context-file>"
|
|
884164
884437
|
].join(`
|
|
884165
884438
|
`);
|
|
@@ -884216,8 +884489,8 @@ function registerPaste(state4, content, projectRoot) {
|
|
|
884216
884489
|
if (IMAGE_EXTENSIONS2.some((ext) => trimmed2.toLowerCase().endsWith(ext))) {
|
|
884217
884490
|
try {
|
|
884218
884491
|
const resolvedPath3 = resolveAndValidatePath(trimmed2, projectRoot);
|
|
884219
|
-
if (
|
|
884220
|
-
const data =
|
|
884492
|
+
if (existsSync88(resolvedPath3)) {
|
|
884493
|
+
const data = readFileSync94(resolvedPath3);
|
|
884221
884494
|
const base644 = data.toString("base64");
|
|
884222
884495
|
const ext = trimmed2.slice(trimmed2.lastIndexOf("."));
|
|
884223
884496
|
const mediaType = mediaTypeFromExt(ext);
|
|
@@ -884267,7 +884540,7 @@ function expandPrompt(pasteRegistry, imageRegistry, text, projectRoot) {
|
|
|
884267
884540
|
const filePath = injectMatch[1];
|
|
884268
884541
|
try {
|
|
884269
884542
|
const resolvedPath3 = resolveAndValidatePath(filePath, projectRoot);
|
|
884270
|
-
const content =
|
|
884543
|
+
const content = readFileSync94(resolvedPath3, "utf-8");
|
|
884271
884544
|
expanded = expanded.slice(0, injectMatch.index) + content + expanded.slice(injectMatch.index + injectMatch[0].length);
|
|
884272
884545
|
injectRegex.lastIndex = injectMatch.index + content.length;
|
|
884273
884546
|
} catch (err2) {
|
|
@@ -885605,7 +885878,7 @@ class AutocompleteEngine {
|
|
|
885605
885878
|
|
|
885606
885879
|
// src/input/file-picker.ts
|
|
885607
885880
|
import { readdir as readdir6 } from "fs/promises";
|
|
885608
|
-
import { join as
|
|
885881
|
+
import { join as join100, relative as relative16 } from "path";
|
|
885609
885882
|
|
|
885610
885883
|
class FilePickerModal {
|
|
885611
885884
|
shellPaths;
|
|
@@ -885738,7 +886011,7 @@ class FilePickerModal {
|
|
|
885738
886011
|
continue;
|
|
885739
886012
|
if (entry.name === "node_modules" || entry.name === "dist")
|
|
885740
886013
|
continue;
|
|
885741
|
-
const fullPath =
|
|
886014
|
+
const fullPath = join100(dir, entry.name);
|
|
885742
886015
|
const relPath = relative16(this.shellPaths.workingDirectory, fullPath);
|
|
885743
886016
|
if (entry.isDirectory()) {
|
|
885744
886017
|
files.push(relPath + "/");
|
|
@@ -893540,7 +893813,7 @@ function handleProfilePickerToken(state4, token) {
|
|
|
893540
893813
|
}
|
|
893541
893814
|
|
|
893542
893815
|
// src/input/handler-picker-routes.ts
|
|
893543
|
-
import { readFileSync as
|
|
893816
|
+
import { readFileSync as readFileSync95 } from "fs";
|
|
893544
893817
|
|
|
893545
893818
|
// src/renderer/model-picker-overlay.ts
|
|
893546
893819
|
var MODEL_PICKER_CHROME_LINES = 7;
|
|
@@ -893832,7 +894105,7 @@ function handleFilePickerToken(state4, token) {
|
|
|
893832
894105
|
throw new Error("working directory is unavailable");
|
|
893833
894106
|
}
|
|
893834
894107
|
const resolvedPath3 = resolveAndValidatePath(selected, projectRoot);
|
|
893835
|
-
const data =
|
|
894108
|
+
const data = readFileSync95(resolvedPath3);
|
|
893836
894109
|
const base644 = data.toString("base64");
|
|
893837
894110
|
const mediaType = state4.mediaTypeFromExt(ext);
|
|
893838
894111
|
const filename = selected.split("/").pop() ?? selected;
|
|
@@ -899791,155 +900064,6 @@ function renderOnboardingCliStatus(options) {
|
|
|
899791
900064
|
].join(`
|
|
899792
900065
|
`);
|
|
899793
900066
|
}
|
|
899794
|
-
// src/cli/external-runtime.ts
|
|
899795
|
-
import { existsSync as existsSync88, readFileSync as readFileSync95 } from "fs";
|
|
899796
|
-
import { join as join100 } from "path";
|
|
899797
|
-
function isRecord43(value) {
|
|
899798
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
899799
|
-
}
|
|
899800
|
-
function readString57(record2, key) {
|
|
899801
|
-
const value = record2?.[key];
|
|
899802
|
-
return typeof value === "string" ? value : null;
|
|
899803
|
-
}
|
|
899804
|
-
function resolveBaseUrl2(configManager) {
|
|
899805
|
-
const host = String(configManager.get("controlPlane.host") ?? "127.0.0.1");
|
|
899806
|
-
const port = Number(configManager.get("controlPlane.port") ?? 3421);
|
|
899807
|
-
return `http://${host}:${Number.isFinite(port) ? port : 3421}`;
|
|
899808
|
-
}
|
|
899809
|
-
function readOperatorToken2(homeDirectory) {
|
|
899810
|
-
const path7 = join100(homeDirectory, ".goodvibes", "daemon", "operator-tokens.json");
|
|
899811
|
-
if (!existsSync88(path7))
|
|
899812
|
-
return { token: null, path: path7 };
|
|
899813
|
-
try {
|
|
899814
|
-
const parsed = JSON.parse(readFileSync95(path7, "utf-8"));
|
|
899815
|
-
const token = isRecord43(parsed) && typeof parsed.token === "string" ? parsed.token : null;
|
|
899816
|
-
return { token, path: path7 };
|
|
899817
|
-
} catch {
|
|
899818
|
-
return { token: null, path: path7 };
|
|
899819
|
-
}
|
|
899820
|
-
}
|
|
899821
|
-
async function fetchJson2(url2, token, timeoutMs) {
|
|
899822
|
-
const controller = new AbortController;
|
|
899823
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
899824
|
-
try {
|
|
899825
|
-
const response5 = await fetch(url2, {
|
|
899826
|
-
headers: token ? { authorization: `Bearer ${token}` } : undefined,
|
|
899827
|
-
signal: controller.signal
|
|
899828
|
-
});
|
|
899829
|
-
const text = await response5.text();
|
|
899830
|
-
let body2 = text;
|
|
899831
|
-
if (text.trim().length > 0) {
|
|
899832
|
-
try {
|
|
899833
|
-
body2 = JSON.parse(text);
|
|
899834
|
-
} catch {
|
|
899835
|
-
body2 = text;
|
|
899836
|
-
}
|
|
899837
|
-
}
|
|
899838
|
-
return { ok: response5.ok, status: response5.status, body: body2 };
|
|
899839
|
-
} finally {
|
|
899840
|
-
clearTimeout(timer);
|
|
899841
|
-
}
|
|
899842
|
-
}
|
|
899843
|
-
async function inspectCliExternalRuntime(options) {
|
|
899844
|
-
const baseUrl = resolveBaseUrl2(options.configManager);
|
|
899845
|
-
const token = readOperatorToken2(options.homeDirectory);
|
|
899846
|
-
const timeoutMs = options.timeoutMs ?? 1500;
|
|
899847
|
-
const route = "/api/goodvibes-agent/knowledge/status";
|
|
899848
|
-
try {
|
|
899849
|
-
const status = await fetchJson2(`${baseUrl}/status`, token.token, timeoutMs);
|
|
899850
|
-
const statusRecord = isRecord43(status.body) ? status.body : {};
|
|
899851
|
-
const version6 = readString57(statusRecord, "version") ?? "unknown";
|
|
899852
|
-
const compatible = status.ok && version6 === SDK_VERSION;
|
|
899853
|
-
if (!status.ok) {
|
|
899854
|
-
return {
|
|
899855
|
-
baseUrl,
|
|
899856
|
-
statusCode: status.status,
|
|
899857
|
-
reachable: false,
|
|
899858
|
-
version: version6,
|
|
899859
|
-
expectedVersion: SDK_VERSION,
|
|
899860
|
-
compatible: false,
|
|
899861
|
-
operatorToken: { present: Boolean(token.token), path: token.path },
|
|
899862
|
-
agentKnowledge: {
|
|
899863
|
-
route,
|
|
899864
|
-
ready: false,
|
|
899865
|
-
kind: status.status === 401 ? "auth_required" : "connected_host_unavailable",
|
|
899866
|
-
statusCode: status.status
|
|
899867
|
-
},
|
|
899868
|
-
error: typeof status.body === "string" ? status.body : `HTTP ${status.status}`
|
|
899869
|
-
};
|
|
899870
|
-
}
|
|
899871
|
-
if (!token.token) {
|
|
899872
|
-
return {
|
|
899873
|
-
baseUrl,
|
|
899874
|
-
statusCode: status.status,
|
|
899875
|
-
reachable: true,
|
|
899876
|
-
version: version6,
|
|
899877
|
-
expectedVersion: SDK_VERSION,
|
|
899878
|
-
compatible,
|
|
899879
|
-
operatorToken: { present: false, path: token.path },
|
|
899880
|
-
agentKnowledge: {
|
|
899881
|
-
route,
|
|
899882
|
-
ready: false,
|
|
899883
|
-
kind: "auth_required",
|
|
899884
|
-
statusCode: null
|
|
899885
|
-
},
|
|
899886
|
-
error: null
|
|
899887
|
-
};
|
|
899888
|
-
}
|
|
899889
|
-
if (!compatible) {
|
|
899890
|
-
return {
|
|
899891
|
-
baseUrl,
|
|
899892
|
-
statusCode: status.status,
|
|
899893
|
-
reachable: true,
|
|
899894
|
-
version: version6,
|
|
899895
|
-
expectedVersion: SDK_VERSION,
|
|
899896
|
-
compatible: false,
|
|
899897
|
-
operatorToken: { present: true, path: token.path },
|
|
899898
|
-
agentKnowledge: {
|
|
899899
|
-
route,
|
|
899900
|
-
ready: false,
|
|
899901
|
-
kind: "version_mismatch",
|
|
899902
|
-
statusCode: null
|
|
899903
|
-
},
|
|
899904
|
-
error: null
|
|
899905
|
-
};
|
|
899906
|
-
}
|
|
899907
|
-
const knowledge2 = await fetchJson2(`${baseUrl}${route}`, token.token, timeoutMs);
|
|
899908
|
-
return {
|
|
899909
|
-
baseUrl,
|
|
899910
|
-
statusCode: status.status,
|
|
899911
|
-
reachable: true,
|
|
899912
|
-
version: version6,
|
|
899913
|
-
expectedVersion: SDK_VERSION,
|
|
899914
|
-
compatible,
|
|
899915
|
-
operatorToken: { present: true, path: token.path },
|
|
899916
|
-
agentKnowledge: {
|
|
899917
|
-
route,
|
|
899918
|
-
ready: knowledge2.ok,
|
|
899919
|
-
kind: knowledge2.ok ? "ok" : knowledge2.status === 401 ? "auth_required" : knowledge2.status === 404 ? "connected_host_route_unavailable" : "connected_host_error",
|
|
899920
|
-
statusCode: knowledge2.status
|
|
899921
|
-
},
|
|
899922
|
-
error: knowledge2.ok ? null : typeof knowledge2.body === "string" ? knowledge2.body : `HTTP ${knowledge2.status}`
|
|
899923
|
-
};
|
|
899924
|
-
} catch (error53) {
|
|
899925
|
-
return {
|
|
899926
|
-
baseUrl,
|
|
899927
|
-
statusCode: null,
|
|
899928
|
-
reachable: false,
|
|
899929
|
-
version: "unknown",
|
|
899930
|
-
expectedVersion: SDK_VERSION,
|
|
899931
|
-
compatible: false,
|
|
899932
|
-
operatorToken: { present: Boolean(token.token), path: token.path },
|
|
899933
|
-
agentKnowledge: {
|
|
899934
|
-
route,
|
|
899935
|
-
ready: false,
|
|
899936
|
-
kind: "connected_host_unavailable",
|
|
899937
|
-
statusCode: null
|
|
899938
|
-
},
|
|
899939
|
-
error: summarizeError(error53)
|
|
899940
|
-
};
|
|
899941
|
-
}
|
|
899942
|
-
}
|
|
899943
900067
|
// src/cli/completion.ts
|
|
899944
900068
|
var COMMANDS = [
|
|
899945
900069
|
"run",
|