agentful 0.4.8 → 0.4.10
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/dist/index.cjs +76 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
mod
|
|
34
34
|
));
|
|
35
35
|
|
|
36
|
-
//
|
|
36
|
+
// node_modules/commander/lib/error.js
|
|
37
37
|
var require_error = __commonJS({
|
|
38
|
-
"
|
|
38
|
+
"node_modules/commander/lib/error.js"(exports2) {
|
|
39
39
|
"use strict";
|
|
40
40
|
var CommanderError2 = class extends Error {
|
|
41
41
|
/**
|
|
@@ -69,9 +69,9 @@ var require_error = __commonJS({
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
//
|
|
72
|
+
// node_modules/commander/lib/argument.js
|
|
73
73
|
var require_argument = __commonJS({
|
|
74
|
-
"
|
|
74
|
+
"node_modules/commander/lib/argument.js"(exports2) {
|
|
75
75
|
"use strict";
|
|
76
76
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
77
77
|
var Argument2 = class {
|
|
@@ -197,9 +197,9 @@ var require_argument = __commonJS({
|
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
-
//
|
|
200
|
+
// node_modules/commander/lib/help.js
|
|
201
201
|
var require_help = __commonJS({
|
|
202
|
-
"
|
|
202
|
+
"node_modules/commander/lib/help.js"(exports2) {
|
|
203
203
|
"use strict";
|
|
204
204
|
var { humanReadableArgName } = require_argument();
|
|
205
205
|
var Help2 = class {
|
|
@@ -612,9 +612,9 @@ var require_help = __commonJS({
|
|
|
612
612
|
}
|
|
613
613
|
});
|
|
614
614
|
|
|
615
|
-
//
|
|
615
|
+
// node_modules/commander/lib/option.js
|
|
616
616
|
var require_option = __commonJS({
|
|
617
|
-
"
|
|
617
|
+
"node_modules/commander/lib/option.js"(exports2) {
|
|
618
618
|
"use strict";
|
|
619
619
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
620
620
|
var Option2 = class {
|
|
@@ -885,9 +885,9 @@ var require_option = __commonJS({
|
|
|
885
885
|
}
|
|
886
886
|
});
|
|
887
887
|
|
|
888
|
-
//
|
|
888
|
+
// node_modules/commander/lib/suggestSimilar.js
|
|
889
889
|
var require_suggestSimilar = __commonJS({
|
|
890
|
-
"
|
|
890
|
+
"node_modules/commander/lib/suggestSimilar.js"(exports2) {
|
|
891
891
|
"use strict";
|
|
892
892
|
var maxDistance = 3;
|
|
893
893
|
function editDistance(a, b) {
|
|
@@ -966,9 +966,9 @@ var require_suggestSimilar = __commonJS({
|
|
|
966
966
|
}
|
|
967
967
|
});
|
|
968
968
|
|
|
969
|
-
//
|
|
969
|
+
// node_modules/commander/lib/command.js
|
|
970
970
|
var require_command = __commonJS({
|
|
971
|
-
"
|
|
971
|
+
"node_modules/commander/lib/command.js"(exports2) {
|
|
972
972
|
"use strict";
|
|
973
973
|
var EventEmitter = require("events").EventEmitter;
|
|
974
974
|
var childProcess = require("child_process");
|
|
@@ -3010,9 +3010,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3010
3010
|
}
|
|
3011
3011
|
});
|
|
3012
3012
|
|
|
3013
|
-
//
|
|
3013
|
+
// node_modules/commander/index.js
|
|
3014
3014
|
var require_commander = __commonJS({
|
|
3015
|
-
"
|
|
3015
|
+
"node_modules/commander/index.js"(exports2) {
|
|
3016
3016
|
"use strict";
|
|
3017
3017
|
var { Argument: Argument2 } = require_argument();
|
|
3018
3018
|
var { Command: Command2 } = require_command();
|
|
@@ -3044,7 +3044,7 @@ var VERSION, brand, useColor, wrap, paint, tuiDesign, sym, ui;
|
|
|
3044
3044
|
var init_branding = __esm({
|
|
3045
3045
|
"src/branding.ts"() {
|
|
3046
3046
|
"use strict";
|
|
3047
|
-
VERSION = "0.4.
|
|
3047
|
+
VERSION = "0.4.10" ? "0.4.10" : null.version;
|
|
3048
3048
|
brand = {
|
|
3049
3049
|
name: "agentful",
|
|
3050
3050
|
// the command users type
|
|
@@ -3103,9 +3103,9 @@ var init_branding = __esm({
|
|
|
3103
3103
|
}
|
|
3104
3104
|
});
|
|
3105
3105
|
|
|
3106
|
-
//
|
|
3106
|
+
// node_modules/ignore/index.js
|
|
3107
3107
|
var require_ignore = __commonJS({
|
|
3108
|
-
"
|
|
3108
|
+
"node_modules/ignore/index.js"(exports2, module2) {
|
|
3109
3109
|
"use strict";
|
|
3110
3110
|
function makeArray(subject) {
|
|
3111
3111
|
return Array.isArray(subject) ? subject : [subject];
|
|
@@ -3491,6 +3491,36 @@ var require_ignore = __commonJS({
|
|
|
3491
3491
|
}
|
|
3492
3492
|
});
|
|
3493
3493
|
|
|
3494
|
+
// src/lib/engineFarewell.ts
|
|
3495
|
+
var FAREWELL_FILTER_SOURCE;
|
|
3496
|
+
var init_engineFarewell = __esm({
|
|
3497
|
+
"src/lib/engineFarewell.ts"() {
|
|
3498
|
+
"use strict";
|
|
3499
|
+
FAREWELL_FILTER_SOURCE = String.raw`
|
|
3500
|
+
/** The engine's quit text: its wordmark, "Session <title>", "Continue opencode -s <id>". */
|
|
3501
|
+
function isEngineFarewell(chunk) {
|
|
3502
|
+
if (typeof chunk !== 'string') return false
|
|
3503
|
+
const plain = chunk.replace(/\x1b\[[0-9;]*m/g, '')
|
|
3504
|
+
return /^ *Continue +opencode -s \S+ *$/m.test(plain)
|
|
3505
|
+
}
|
|
3506
|
+
|
|
3507
|
+
/** Drop the farewell once, then step aside. Called from api.lifecycle.onDispose. */
|
|
3508
|
+
function dropEngineFarewell() {
|
|
3509
|
+
const out = process.stdout
|
|
3510
|
+
const write = out.write
|
|
3511
|
+
const filtered = function (chunk, ...rest) {
|
|
3512
|
+
if (!isEngineFarewell(chunk)) return write.call(this, chunk, ...rest)
|
|
3513
|
+
if (out.write === filtered) out.write = write
|
|
3514
|
+
const done = rest.find((arg) => typeof arg === 'function')
|
|
3515
|
+
if (done) queueMicrotask(() => done())
|
|
3516
|
+
return true
|
|
3517
|
+
}
|
|
3518
|
+
out.write = filtered
|
|
3519
|
+
}
|
|
3520
|
+
`;
|
|
3521
|
+
}
|
|
3522
|
+
});
|
|
3523
|
+
|
|
3494
3524
|
// src/branding/logo.txt
|
|
3495
3525
|
var logo_default;
|
|
3496
3526
|
var init_logo = __esm({
|
|
@@ -3536,10 +3566,14 @@ function tail(text, max) {
|
|
|
3536
3566
|
const s = String(text)
|
|
3537
3567
|
return s.length <= max ? s : '\u2026' + s.slice(s.length - (max - 1))
|
|
3538
3568
|
}
|
|
3539
|
-
|
|
3569
|
+
${FAREWELL_FILTER_SOURCE}
|
|
3540
3570
|
const plugin = {
|
|
3541
3571
|
id: 'agentful-branding',
|
|
3542
3572
|
tui(api) {
|
|
3573
|
+
// Through safe(): a throw here would make the host roll back the whole
|
|
3574
|
+
// plugin, and the design with it \u2014 for the sake of one line on quit.
|
|
3575
|
+
safe(() => api.lifecycle.onDispose(dropEngineFarewell))
|
|
3576
|
+
|
|
3543
3577
|
const Prompt = api.ui.Prompt
|
|
3544
3578
|
const HostSlot = api.ui.Slot
|
|
3545
3579
|
// The slot context carries no colors; the theme lives on the plugin api.
|
|
@@ -3820,11 +3854,12 @@ var init_plugin = __esm({
|
|
|
3820
3854
|
"src/branding/plugin.ts"() {
|
|
3821
3855
|
"use strict";
|
|
3822
3856
|
init_branding();
|
|
3857
|
+
init_engineFarewell();
|
|
3823
3858
|
init_logo();
|
|
3824
3859
|
}
|
|
3825
3860
|
});
|
|
3826
3861
|
|
|
3827
|
-
//
|
|
3862
|
+
// node_modules/commander/esm.mjs
|
|
3828
3863
|
var import_index = __toESM(require_commander(), 1);
|
|
3829
3864
|
var {
|
|
3830
3865
|
program,
|
|
@@ -4785,7 +4820,7 @@ init_branding();
|
|
|
4785
4820
|
var import_node_fs4 = require("fs");
|
|
4786
4821
|
var import_node_path6 = require("path");
|
|
4787
4822
|
|
|
4788
|
-
//
|
|
4823
|
+
// node_modules/fflate/esm/index.mjs
|
|
4789
4824
|
var import_module = require("module");
|
|
4790
4825
|
var require2 = (0, import_module.createRequire)("/");
|
|
4791
4826
|
var _a;
|
|
@@ -6932,7 +6967,7 @@ var import_node_stream = require("stream");
|
|
|
6932
6967
|
var import_promises3 = require("stream/promises");
|
|
6933
6968
|
init_branding();
|
|
6934
6969
|
var ENGINE_BINARY = "agentful-engine";
|
|
6935
|
-
var FALLBACK_ENGINE_VERSION = "v1.18.
|
|
6970
|
+
var FALLBACK_ENGINE_VERSION = "v1.18.32";
|
|
6936
6971
|
function compareVersions(a, b) {
|
|
6937
6972
|
const pa = a.replace(/^v/, "").split(".").map((n) => parseInt(n, 10) || 0);
|
|
6938
6973
|
const pb = b.replace(/^v/, "").split(".").map((n) => parseInt(n, 10) || 0);
|
|
@@ -7524,6 +7559,7 @@ var DISABLED_ENGINE_PLUGINS = {
|
|
|
7524
7559
|
"internal:sidebar-todo": false,
|
|
7525
7560
|
"internal:sidebar-files": false
|
|
7526
7561
|
};
|
|
7562
|
+
var GATEWAY_STREAM_TIMEOUT_MS = 6e5;
|
|
7527
7563
|
var CLOUD_AGENT = "agentful-build";
|
|
7528
7564
|
var LOCAL_AGENT = "local-only";
|
|
7529
7565
|
var SERVER_SIDE_IN_ONE_SENTENCE = `static files only; no server process in the app \u2014 server-side logic = Managed Server Actions (\`.server/actions/*.js\`, request/response, ${contract_default.server_side.managed_actions.limits.action_timeout_budget_s} s budget) or an API of your own; no cron, no sockets, no npm inside actions; no build-time secrets`;
|
|
@@ -7589,7 +7625,12 @@ function buildEngineConfig(opts) {
|
|
|
7589
7625
|
[PROVIDER_ID]: {
|
|
7590
7626
|
npm: "@ai-sdk/openai-compatible",
|
|
7591
7627
|
name: "Agentful",
|
|
7592
|
-
options: {
|
|
7628
|
+
options: {
|
|
7629
|
+
baseURL: opts.session.gateway_url,
|
|
7630
|
+
apiKey: opts.session.token,
|
|
7631
|
+
headerTimeout: GATEWAY_STREAM_TIMEOUT_MS,
|
|
7632
|
+
chunkTimeout: GATEWAY_STREAM_TIMEOUT_MS
|
|
7633
|
+
},
|
|
7593
7634
|
models
|
|
7594
7635
|
}
|
|
7595
7636
|
}
|
|
@@ -8262,6 +8303,7 @@ function describeModelRoute(model, catalog, localProviders, connectedProviders)
|
|
|
8262
8303
|
}
|
|
8263
8304
|
|
|
8264
8305
|
// src/lib/engineEvents.ts
|
|
8306
|
+
var import_node_crypto2 = require("crypto");
|
|
8265
8307
|
var import_node_net = require("net");
|
|
8266
8308
|
function payloadOf(event) {
|
|
8267
8309
|
return event.payload && typeof event.payload === "object" ? event.payload : event;
|
|
@@ -8384,6 +8426,12 @@ var EngineLivenessPolicy = class {
|
|
|
8384
8426
|
this.activityRevision += 1;
|
|
8385
8427
|
}
|
|
8386
8428
|
};
|
|
8429
|
+
function engineServerCredentials(env = process.env) {
|
|
8430
|
+
return {
|
|
8431
|
+
username: env.OPENCODE_SERVER_USERNAME || void 0,
|
|
8432
|
+
password: env.OPENCODE_SERVER_PASSWORD || (0, import_node_crypto2.randomUUID)()
|
|
8433
|
+
};
|
|
8434
|
+
}
|
|
8387
8435
|
async function reserveLoopbackPort() {
|
|
8388
8436
|
return new Promise((resolve2, reject) => {
|
|
8389
8437
|
const server = (0, import_node_net.createServer)();
|
|
@@ -8635,13 +8683,14 @@ async function tuiCommand(opts = {}) {
|
|
|
8635
8683
|
let code = 0;
|
|
8636
8684
|
let sessionID = opts.session;
|
|
8637
8685
|
let selectedPin = initialPin;
|
|
8686
|
+
const serverAuth = engineServerCredentials();
|
|
8638
8687
|
for (; ; ) {
|
|
8639
8688
|
const port = await reserveLoopbackPort();
|
|
8640
8689
|
const monitor = startEngineEventMonitor({
|
|
8641
8690
|
port,
|
|
8642
8691
|
directory: process.cwd(),
|
|
8643
|
-
username:
|
|
8644
|
-
password:
|
|
8692
|
+
username: serverAuth.username,
|
|
8693
|
+
password: serverAuth.password
|
|
8645
8694
|
});
|
|
8646
8695
|
code = await new Promise((resolve2) => {
|
|
8647
8696
|
const engineArgs = [
|
|
@@ -8663,6 +8712,9 @@ async function tuiCommand(opts = {}) {
|
|
|
8663
8712
|
XDG_CONFIG_HOME: xdg.configHome,
|
|
8664
8713
|
XDG_DATA_HOME: xdg.dataHome,
|
|
8665
8714
|
XDG_STATE_HOME: xdg.stateHome,
|
|
8715
|
+
// The loopback server is reachable from any browser tab; a random
|
|
8716
|
+
// password keeps web pages out (engineServerCredentials).
|
|
8717
|
+
OPENCODE_SERVER_PASSWORD: serverAuth.password,
|
|
8666
8718
|
// Belt and braces with `autoupdate: false` in the config: engine
|
|
8667
8719
|
// versions are rolled out through our manifest, never self-updated.
|
|
8668
8720
|
OPENCODE_DISABLE_AUTOUPDATE: "true",
|