@tryvira/opencode 0.1.87 → 0.1.88
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/README.md +1 -1
- package/dist/index.js +15 -15
- package/dist/server.js +16 -16
- package/dist/tui.js +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/index.ts
|
|
7
|
+
// packages/opencode-plugin/src/index.ts
|
|
8
8
|
import { createHash as createHash4, randomUUID } from "node:crypto";
|
|
9
9
|
|
|
10
|
-
//
|
|
10
|
+
// contracts/external-host-commercial-v1.ts
|
|
11
11
|
var externalHostCommercialEvidence = Object.freeze({
|
|
12
12
|
schemaVersion: 1,
|
|
13
13
|
chargeClass: "byok",
|
|
@@ -16,7 +16,7 @@ var externalHostCommercialEvidence = Object.freeze({
|
|
|
16
16
|
managedCreditEligible: false
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// contracts/observation-event-identity.ts
|
|
20
20
|
function requiredIdentityPart(value, code) {
|
|
21
21
|
if (typeof value !== "string" || !value.trim() || value !== value.trim()) throw new Error(code);
|
|
22
22
|
return value;
|
|
@@ -28,7 +28,7 @@ function createConversationOutputObservationIdentity(input2) {
|
|
|
28
28
|
return Object.freeze({ conversationId, requestId, eventId, idempotencyKey: `conversation.output:${eventId}` });
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
//
|
|
31
|
+
// sdks/js-client.ts
|
|
32
32
|
var listQuery = (options) => ({
|
|
33
33
|
...options.limit === void 0 ? {} : { limit: String(options.limit) },
|
|
34
34
|
...options.cursor ? { cursor: options.cursor } : {},
|
|
@@ -2371,10 +2371,10 @@ function buildObservationRequest(event) {
|
|
|
2371
2371
|
});
|
|
2372
2372
|
}
|
|
2373
2373
|
|
|
2374
|
-
//
|
|
2374
|
+
// sdks/host-lifecycle.ts
|
|
2375
2375
|
import { createHash as createHash2 } from "node:crypto";
|
|
2376
2376
|
|
|
2377
|
-
//
|
|
2377
|
+
// sdks/host-taskrun-handoff.ts
|
|
2378
2378
|
import { createHash } from "node:crypto";
|
|
2379
2379
|
var record = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
2380
2380
|
var nonempty = (v) => typeof v === "string" && v.length > 0 && v === v.trim();
|
|
@@ -2429,7 +2429,7 @@ function readHostTaskRunResult(response, run) {
|
|
|
2429
2429
|
return Object.freeze({ ...terminal, outputAvailable: true, resultDigest, outputs });
|
|
2430
2430
|
}
|
|
2431
2431
|
|
|
2432
|
-
//
|
|
2432
|
+
// sdks/host-lifecycle.ts
|
|
2433
2433
|
var nonEmpty = (value, code) => {
|
|
2434
2434
|
if (typeof value !== "string" || !value.trim()) throw new Error(code);
|
|
2435
2435
|
return value.trim();
|
|
@@ -2719,7 +2719,7 @@ function createViraHostRuntime(client, config2) {
|
|
|
2719
2719
|
return Object.freeze({ mode, capabilities, connectOnce, reconnect, getConnectionIdentity: () => connectionIdentity, beforeModel, beforeTool, afterTool, executeTool, cancelTool, endSession, getProjection: (identity) => projections.get(sessionKey({ ...identity, requestId: "projection", input: "" })), supportsPostModelVerification: capabilities.canInterceptResponseBeforeDisplay });
|
|
2720
2720
|
}
|
|
2721
2721
|
|
|
2722
|
-
//
|
|
2722
|
+
// packages/runtime/src/accelerator-v4/composite-hook-session.ts
|
|
2723
2723
|
import { createHash as createHash3, createHmac } from "node:crypto";
|
|
2724
2724
|
|
|
2725
2725
|
|
|
@@ -22439,7 +22439,7 @@ function date4(params) {
|
|
|
22439
22439
|
return _coercedDate(ZodDate, params);
|
|
22440
22440
|
}
|
|
22441
22441
|
|
|
22442
|
-
//
|
|
22442
|
+
// packages/runtime/src/accelerator-v4/composite-hook-session.ts
|
|
22443
22443
|
var hash2 = (value) => createHash3("sha256").update(canonical2(value)).digest("hex");
|
|
22444
22444
|
var canonical2 = (value) => Array.isArray(value) ? `[${value.map(canonical2).join(",")}]` : value && typeof value === "object" ? `{${Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${JSON.stringify(k)}:${canonical2(v)}`).join(",")}}` : JSON.stringify(value);
|
|
22445
22445
|
var canonicalToolArguments = (value) => Array.isArray(value) ? `[${value.map(canonicalToolArguments).join(",")}]` : value && typeof value === "object" ? `{${Object.keys(value).sort((a, b) => a < b ? -1 : a > b ? 1 : 0).map((key) => `${JSON.stringify(key)}:${canonicalToolArguments(value[key])}`).join(",")}}` : JSON.stringify(value);
|
|
@@ -22565,7 +22565,7 @@ function validateToolProposalV1(value, context) {
|
|
|
22565
22565
|
return freezeDeep(proposal);
|
|
22566
22566
|
}
|
|
22567
22567
|
|
|
22568
|
-
// src/approval.ts
|
|
22568
|
+
// packages/opencode-plugin/src/approval.ts
|
|
22569
22569
|
var text = (value) => typeof value === "string" ? value.trim() : "";
|
|
22570
22570
|
var record3 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
22571
22571
|
var errorCode = (error62) => {
|
|
@@ -22623,7 +22623,7 @@ async function authorizeWithOneShotCustomerConfirmation(input2) {
|
|
|
22623
22623
|
}
|
|
22624
22624
|
}
|
|
22625
22625
|
|
|
22626
|
-
// src/host-call-fence.ts
|
|
22626
|
+
// packages/opencode-plugin/src/host-call-fence.ts
|
|
22627
22627
|
function createHostCallExecutionFence(maxEntries = 1e5) {
|
|
22628
22628
|
if (!Number.isSafeInteger(maxEntries) || maxEntries < 1)
|
|
22629
22629
|
throw new Error("OPENCODE_HOST_FENCE_CAPACITY_INVALID");
|
|
@@ -22646,7 +22646,7 @@ function createHostCallExecutionFence(maxEntries = 1e5) {
|
|
|
22646
22646
|
});
|
|
22647
22647
|
}
|
|
22648
22648
|
|
|
22649
|
-
// src/taskrun-handoff.ts
|
|
22649
|
+
// packages/opencode-plugin/src/taskrun-handoff.ts
|
|
22650
22650
|
var openCodeHostRequestId = (identity, messageId, input2, fallback) => messageId ? stableHostTaskRunRequest(identity, messageId, input2) : fallback;
|
|
22651
22651
|
var OpenCodeTaskRunHandoffError = class extends Error {
|
|
22652
22652
|
taskRunId;
|
|
@@ -22697,7 +22697,7 @@ async function openCodeTaskRunHandoffError(client, run) {
|
|
|
22697
22697
|
return new OpenCodeTaskRunHandoffError(run, hostTaskRunTerminal(run.status) ? await readOpenCodeTaskRunTerminalEvidence(client, run) : void 0);
|
|
22698
22698
|
}
|
|
22699
22699
|
|
|
22700
|
-
// src/taskrun-result-display.ts
|
|
22700
|
+
// packages/opencode-plugin/src/taskrun-result-display.ts
|
|
22701
22701
|
var record4 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
22702
22702
|
function createLegacyTaskRunResultDisplay(host) {
|
|
22703
22703
|
const session = record4(record4(host).client).session;
|
|
@@ -22756,7 +22756,7 @@ function createOpenCodeResultDelivery(input2) {
|
|
|
22756
22756
|
return { start, state: (taskRunId) => attempts.get(taskRunId)?.state };
|
|
22757
22757
|
}
|
|
22758
22758
|
|
|
22759
|
-
// src/index.ts
|
|
22759
|
+
// packages/opencode-plugin/src/index.ts
|
|
22760
22760
|
async function queueOpenCodeTaskRunHostDispatch(client, input2) {
|
|
22761
22761
|
const response = await client.getTaskRunEvidence(input2.taskRunId);
|
|
22762
22762
|
const run = response?.body?.evidence;
|
|
@@ -23796,7 +23796,7 @@ Object.assign(legacyDefault, v2Plugin, v1Fallback);
|
|
|
23796
23796
|
var server = v1Fallback.server;
|
|
23797
23797
|
var index_default = legacyDefault;
|
|
23798
23798
|
|
|
23799
|
-
// src/runtime-entry.ts
|
|
23799
|
+
// packages/opencode-plugin/src/runtime-entry.ts
|
|
23800
23800
|
var runtime = Object.assign(index_default, {
|
|
23801
23801
|
id: "vira",
|
|
23802
23802
|
setup: index_default.setup,
|
package/dist/server.js
CHANGED
|
@@ -4,10 +4,10 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/index.ts
|
|
7
|
+
// packages/opencode-plugin/src/index.ts
|
|
8
8
|
import { createHash as createHash4, randomUUID } from "node:crypto";
|
|
9
9
|
|
|
10
|
-
//
|
|
10
|
+
// contracts/external-host-commercial-v1.ts
|
|
11
11
|
var externalHostCommercialEvidence = Object.freeze({
|
|
12
12
|
schemaVersion: 1,
|
|
13
13
|
chargeClass: "byok",
|
|
@@ -16,7 +16,7 @@ var externalHostCommercialEvidence = Object.freeze({
|
|
|
16
16
|
managedCreditEligible: false
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// contracts/observation-event-identity.ts
|
|
20
20
|
function requiredIdentityPart(value, code) {
|
|
21
21
|
if (typeof value !== "string" || !value.trim() || value !== value.trim()) throw new Error(code);
|
|
22
22
|
return value;
|
|
@@ -28,7 +28,7 @@ function createConversationOutputObservationIdentity(input2) {
|
|
|
28
28
|
return Object.freeze({ conversationId, requestId, eventId, idempotencyKey: `conversation.output:${eventId}` });
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
//
|
|
31
|
+
// sdks/js-client.ts
|
|
32
32
|
var listQuery = (options) => ({
|
|
33
33
|
...options.limit === void 0 ? {} : { limit: String(options.limit) },
|
|
34
34
|
...options.cursor ? { cursor: options.cursor } : {},
|
|
@@ -2371,10 +2371,10 @@ function buildObservationRequest(event) {
|
|
|
2371
2371
|
});
|
|
2372
2372
|
}
|
|
2373
2373
|
|
|
2374
|
-
//
|
|
2374
|
+
// sdks/host-lifecycle.ts
|
|
2375
2375
|
import { createHash as createHash2 } from "node:crypto";
|
|
2376
2376
|
|
|
2377
|
-
//
|
|
2377
|
+
// sdks/host-taskrun-handoff.ts
|
|
2378
2378
|
import { createHash } from "node:crypto";
|
|
2379
2379
|
var record = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
2380
2380
|
var nonempty = (v) => typeof v === "string" && v.length > 0 && v === v.trim();
|
|
@@ -2429,7 +2429,7 @@ function readHostTaskRunResult(response, run) {
|
|
|
2429
2429
|
return Object.freeze({ ...terminal, outputAvailable: true, resultDigest, outputs });
|
|
2430
2430
|
}
|
|
2431
2431
|
|
|
2432
|
-
//
|
|
2432
|
+
// sdks/host-lifecycle.ts
|
|
2433
2433
|
var nonEmpty = (value, code) => {
|
|
2434
2434
|
if (typeof value !== "string" || !value.trim()) throw new Error(code);
|
|
2435
2435
|
return value.trim();
|
|
@@ -2719,7 +2719,7 @@ function createViraHostRuntime(client, config2) {
|
|
|
2719
2719
|
return Object.freeze({ mode, capabilities, connectOnce, reconnect, getConnectionIdentity: () => connectionIdentity, beforeModel, beforeTool, afterTool, executeTool, cancelTool, endSession, getProjection: (identity) => projections.get(sessionKey({ ...identity, requestId: "projection", input: "" })), supportsPostModelVerification: capabilities.canInterceptResponseBeforeDisplay });
|
|
2720
2720
|
}
|
|
2721
2721
|
|
|
2722
|
-
//
|
|
2722
|
+
// packages/runtime/src/accelerator-v4/composite-hook-session.ts
|
|
2723
2723
|
import { createHash as createHash3, createHmac } from "node:crypto";
|
|
2724
2724
|
|
|
2725
2725
|
|
|
@@ -22439,7 +22439,7 @@ function date4(params) {
|
|
|
22439
22439
|
return _coercedDate(ZodDate, params);
|
|
22440
22440
|
}
|
|
22441
22441
|
|
|
22442
|
-
//
|
|
22442
|
+
// packages/runtime/src/accelerator-v4/composite-hook-session.ts
|
|
22443
22443
|
var hash2 = (value) => createHash3("sha256").update(canonical2(value)).digest("hex");
|
|
22444
22444
|
var canonical2 = (value) => Array.isArray(value) ? `[${value.map(canonical2).join(",")}]` : value && typeof value === "object" ? `{${Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${JSON.stringify(k)}:${canonical2(v)}`).join(",")}}` : JSON.stringify(value);
|
|
22445
22445
|
var canonicalToolArguments = (value) => Array.isArray(value) ? `[${value.map(canonicalToolArguments).join(",")}]` : value && typeof value === "object" ? `{${Object.keys(value).sort((a, b) => a < b ? -1 : a > b ? 1 : 0).map((key) => `${JSON.stringify(key)}:${canonicalToolArguments(value[key])}`).join(",")}}` : JSON.stringify(value);
|
|
@@ -22565,7 +22565,7 @@ function validateToolProposalV1(value, context) {
|
|
|
22565
22565
|
return freezeDeep(proposal);
|
|
22566
22566
|
}
|
|
22567
22567
|
|
|
22568
|
-
// src/approval.ts
|
|
22568
|
+
// packages/opencode-plugin/src/approval.ts
|
|
22569
22569
|
var text = (value) => typeof value === "string" ? value.trim() : "";
|
|
22570
22570
|
var record3 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
22571
22571
|
var errorCode = (error62) => {
|
|
@@ -22623,7 +22623,7 @@ async function authorizeWithOneShotCustomerConfirmation(input2) {
|
|
|
22623
22623
|
}
|
|
22624
22624
|
}
|
|
22625
22625
|
|
|
22626
|
-
// src/host-call-fence.ts
|
|
22626
|
+
// packages/opencode-plugin/src/host-call-fence.ts
|
|
22627
22627
|
function createHostCallExecutionFence(maxEntries = 1e5) {
|
|
22628
22628
|
if (!Number.isSafeInteger(maxEntries) || maxEntries < 1)
|
|
22629
22629
|
throw new Error("OPENCODE_HOST_FENCE_CAPACITY_INVALID");
|
|
@@ -22646,7 +22646,7 @@ function createHostCallExecutionFence(maxEntries = 1e5) {
|
|
|
22646
22646
|
});
|
|
22647
22647
|
}
|
|
22648
22648
|
|
|
22649
|
-
// src/taskrun-handoff.ts
|
|
22649
|
+
// packages/opencode-plugin/src/taskrun-handoff.ts
|
|
22650
22650
|
var openCodeHostRequestId = (identity, messageId, input2, fallback) => messageId ? stableHostTaskRunRequest(identity, messageId, input2) : fallback;
|
|
22651
22651
|
var OpenCodeTaskRunHandoffError = class extends Error {
|
|
22652
22652
|
taskRunId;
|
|
@@ -22697,7 +22697,7 @@ async function openCodeTaskRunHandoffError(client, run) {
|
|
|
22697
22697
|
return new OpenCodeTaskRunHandoffError(run, hostTaskRunTerminal(run.status) ? await readOpenCodeTaskRunTerminalEvidence(client, run) : void 0);
|
|
22698
22698
|
}
|
|
22699
22699
|
|
|
22700
|
-
// src/taskrun-result-display.ts
|
|
22700
|
+
// packages/opencode-plugin/src/taskrun-result-display.ts
|
|
22701
22701
|
var record4 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
22702
22702
|
function createLegacyTaskRunResultDisplay(host) {
|
|
22703
22703
|
const session = record4(record4(host).client).session;
|
|
@@ -22756,7 +22756,7 @@ function createOpenCodeResultDelivery(input2) {
|
|
|
22756
22756
|
return { start, state: (taskRunId) => attempts.get(taskRunId)?.state };
|
|
22757
22757
|
}
|
|
22758
22758
|
|
|
22759
|
-
// src/index.ts
|
|
22759
|
+
// packages/opencode-plugin/src/index.ts
|
|
22760
22760
|
async function queueOpenCodeTaskRunHostDispatch(client, input2) {
|
|
22761
22761
|
const response = await client.getTaskRunEvidence(input2.taskRunId);
|
|
22762
22762
|
const run = response?.body?.evidence;
|
|
@@ -23796,7 +23796,7 @@ Object.assign(legacyDefault, v2Plugin, v1Fallback);
|
|
|
23796
23796
|
var server = v1Fallback.server;
|
|
23797
23797
|
var index_default = legacyDefault;
|
|
23798
23798
|
|
|
23799
|
-
// src/runtime-entry.ts
|
|
23799
|
+
// packages/opencode-plugin/src/runtime-entry.ts
|
|
23800
23800
|
var runtime = Object.assign(index_default, {
|
|
23801
23801
|
id: "vira",
|
|
23802
23802
|
setup: index_default.setup,
|
|
@@ -23819,7 +23819,7 @@ var runtime = Object.assign(index_default, {
|
|
|
23819
23819
|
});
|
|
23820
23820
|
var runtime_entry_default = runtime;
|
|
23821
23821
|
|
|
23822
|
-
// src/server-entry.ts
|
|
23822
|
+
// packages/opencode-plugin/src/server-entry.ts
|
|
23823
23823
|
var server_entry_default = { id: "vira", setup: runtime_entry_default.setup, server: runtime_entry_default.server };
|
|
23824
23824
|
export {
|
|
23825
23825
|
server_entry_default as default
|
package/dist/tui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// sdks/js-client.ts
|
|
2
2
|
var listQuery = (options) => ({
|
|
3
3
|
...options.limit === void 0 ? {} : { limit: String(options.limit) },
|
|
4
4
|
...options.cursor ? { cursor: options.cursor } : {},
|
|
@@ -2341,7 +2341,7 @@ function buildObservationRequest(event) {
|
|
|
2341
2341
|
});
|
|
2342
2342
|
}
|
|
2343
2343
|
|
|
2344
|
-
//
|
|
2344
|
+
// sdks/host-taskrun-handoff.ts
|
|
2345
2345
|
import { createHash } from "node:crypto";
|
|
2346
2346
|
var record = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
2347
2347
|
var nonempty = (v) => typeof v === "string" && v.length > 0 && v === v.trim();
|
|
@@ -2392,7 +2392,7 @@ function readHostTaskRunResult(response, run) {
|
|
|
2392
2392
|
return Object.freeze({ ...terminal, outputAvailable: true, resultDigest, outputs });
|
|
2393
2393
|
}
|
|
2394
2394
|
|
|
2395
|
-
// src/tui-result.ts
|
|
2395
|
+
// packages/opencode-plugin/src/tui-result.ts
|
|
2396
2396
|
var isHostResultId = (value) => typeof value === "string" && /^host-task-run-host-turn:[a-f0-9]{64}$/.test(value);
|
|
2397
2397
|
async function readTuiTaskRunResult(client, identity, id, active) {
|
|
2398
2398
|
if (!isHostResultId(id) || Object.values(identity).some((value) => typeof value !== "string" || !value.trim() || value.trim() !== value) || identity.sessionId !== identity.conversationId || !active()) throw Error("OPENCODE_TUI_RESULT_SCOPE_REQUIRED");
|
|
@@ -2410,7 +2410,7 @@ function formatTuiResult(outputs) {
|
|
|
2410
2410
|
return outputs.map((child) => typeof child.output === "string" ? child.output : JSON.stringify(child.output, null, 2)).join("\n\n").replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, "");
|
|
2411
2411
|
}
|
|
2412
2412
|
|
|
2413
|
-
// src/tui-result-selection.ts
|
|
2413
|
+
// packages/opencode-plugin/src/tui-result-selection.ts
|
|
2414
2414
|
var record2 = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
|
|
2415
2415
|
var valid = (v) => typeof v === "string" && v.length > 0 && v.length <= 256 && v === v.trim();
|
|
2416
2416
|
async function selectSessionTaskRun(client, identity, active) {
|
|
@@ -2433,7 +2433,7 @@ async function selectSessionTaskRun(client, identity, active) {
|
|
|
2433
2433
|
return selected;
|
|
2434
2434
|
}
|
|
2435
2435
|
|
|
2436
|
-
// src/tui-entry.ts
|
|
2436
|
+
// packages/opencode-plugin/src/tui-entry.ts
|
|
2437
2437
|
var val = (value) => typeof value === "string" ? value.trim() : "";
|
|
2438
2438
|
var tui_entry_default = { id: "vira.cli", setup(context) {
|
|
2439
2439
|
let busy = false, disposed = false;
|