@cotal-ai/connector-opencode 0.77.0 → 0.78.0
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.js +7 -4
- package/dist/launch.d.ts.map +1 -1
- package/dist/launch.js +5 -2
- package/dist/plugin/index.js +238 -175
- package/dist/serve.js +5 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -17,13 +17,13 @@ import { DEFAULT_SERVER, DEV_OWNER, LAUNCH_MATERIAL_ENV as LAUNCH_MATERIAL_ENV2,
|
|
|
17
17
|
import { LAUNCH_MATERIAL_ENV, readLaunchMaterial } from "@cotal-ai/core/launch-material";
|
|
18
18
|
|
|
19
19
|
// ../connector-core/dist/agent.js
|
|
20
|
-
import { normalizeMentions, RUN_LAUNCH_DEADLINE_MS, subjectMatches, isConcreteChannel as isConcreteChannel2, assertValidChannel as assertValidChannel2, channelInAllow as channelInAllow2, resolvePeer as resolvePeerInRoster, peerLabel as peerLabel2, CotalEndpoint, acquireLocalConsumer, BASELINE_LIFECYCLE_ENDPOINT as BASELINE_LIFECYCLE_ENDPOINT2, BIND_SPLIT_REISSUES, assertLifecycleToken as assertLifecycleToken2, EpEnvelopeError, isPublishPermissionDenied, unansweredRequest, renderLifecycleBlocked, controlReplyFrom, runAgentBearer, partsToText, assertValidRole } from "@cotal-ai/core";
|
|
20
|
+
import { normalizeMentions, RUN_LAUNCH_DEADLINE_MS, subjectMatches, isConcreteChannel as isConcreteChannel2, assertValidChannel as assertValidChannel2, channelInAllow as channelInAllow2, resolvePeer as resolvePeerInRoster, peerLabel as peerLabel2, CotalEndpoint, acquireLocalConsumer, BASELINE_LIFECYCLE_ENDPOINT as BASELINE_LIFECYCLE_ENDPOINT2, BIND_SPLIT_REISSUES, assertLifecycleToken as assertLifecycleToken2, EpEnvelopeError as EpEnvelopeError2, isPublishPermissionDenied, unansweredRequest, renderLifecycleBlocked, controlReplyFrom, runAgentBearer, partsToText, assertValidRole } from "@cotal-ai/core";
|
|
21
21
|
|
|
22
22
|
// ../connector-core/dist/framing.js
|
|
23
23
|
import { peerLabel } from "@cotal-ai/core";
|
|
24
24
|
|
|
25
25
|
// ../connector-core/dist/manager-call.js
|
|
26
|
-
import { BASELINE_LIFECYCLE_ENDPOINT, dialerFor, goalFollowRefusal, invokeCommand, isPermissionDenied, issuedUserCaller, managerCallerBinding, replyRefusedBeforeEffect, resolveService, standaloneConnectOpts } from "@cotal-ai/core";
|
|
26
|
+
import { BASELINE_LIFECYCLE_ENDPOINT, EpEnvelopeError, dialerFor, goalFollowRefusal, invokeCommand, isPermissionDenied, issuedUserCaller, managerCallerBinding, replyRefusedBeforeEffect, resolveService, standaloneConnectOpts } from "@cotal-ai/core";
|
|
27
27
|
|
|
28
28
|
// ../connector-core/dist/runtime.js
|
|
29
29
|
import { tmpdir } from "node:os";
|
|
@@ -185,6 +185,9 @@ function materialEnv(opts) {
|
|
|
185
185
|
return {};
|
|
186
186
|
return { [LAUNCH_MATERIAL_ENV3]: writeLaunchMaterial(material) };
|
|
187
187
|
}
|
|
188
|
+
function launchArmsEvents(opts) {
|
|
189
|
+
return opts.events !== false || opts.eventsRequired === true;
|
|
190
|
+
}
|
|
188
191
|
|
|
189
192
|
// ../connector-core/dist/agui.js
|
|
190
193
|
import { AGUI_FRAME_KIND, AGUI_EVENT_TYPE, isAguiFramePart } from "@cotal-ai/core";
|
|
@@ -14866,7 +14869,7 @@ function date4(params) {
|
|
|
14866
14869
|
config(en_default());
|
|
14867
14870
|
|
|
14868
14871
|
// ../connector-core/dist/tool-specs.js
|
|
14869
|
-
import { isConcreteChannel as isConcreteChannel3, channelInAllow as channelInAllow3, AmbiguousPeerError, peerLabel as peerLabel4, assertLifecycleToken as assertLifecycleToken3, isPermissionDenied as isPermissionDenied2, renderLifecycleBlocked as renderLifecycleBlocked2, EpEnvelopeError as
|
|
14872
|
+
import { isConcreteChannel as isConcreteChannel3, channelInAllow as channelInAllow3, AmbiguousPeerError, peerLabel as peerLabel4, assertLifecycleToken as assertLifecycleToken3, isPermissionDenied as isPermissionDenied2, renderLifecycleBlocked as renderLifecycleBlocked2, EpEnvelopeError as EpEnvelopeError3, LANG_PROBLEM_DETAIL_KIND, formatAge, presenceAges } from "@cotal-ai/core";
|
|
14870
14873
|
|
|
14871
14874
|
// ../connector-core/dist/orientation.js
|
|
14872
14875
|
import { peerLabel as peerLabel3 } from "@cotal-ai/core";
|
|
@@ -15015,7 +15018,7 @@ var opencodeConnector = {
|
|
|
15015
15018
|
COTAL_NAME: opts.name
|
|
15016
15019
|
};
|
|
15017
15020
|
if (opts.resolvedBinaries?.opencode) env.COTAL_OPENCODE_RESOLVED_BIN = opts.resolvedBinaries.opencode;
|
|
15018
|
-
if (opts
|
|
15021
|
+
if (launchArmsEvents(opts)) {
|
|
15019
15022
|
env.COTAL_EVENTS = "1";
|
|
15020
15023
|
if (!opts.workspaceRoot)
|
|
15021
15024
|
throw new Error(
|
package/dist/launch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,GAAG,QAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,GAAG,QAAuB,CAAC;AA+ExC;kEACkE;AAClE,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAEtH;;0BAE0B;AAC1B,MAAM,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,UAAU,CAAC;AAEhE,wBAAsB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA6JjF"}
|
package/dist/launch.js
CHANGED
|
@@ -32,6 +32,7 @@ function resolveOpencodeBin() {
|
|
|
32
32
|
var BIN = resolveOpencodeBin();
|
|
33
33
|
var USERNAME = "opencode";
|
|
34
34
|
var SECRET = process.env.OPENCODE_SERVER_PASSWORD || randomBytes(24).toString("hex");
|
|
35
|
+
var RECORD_THEN_EXEC = `printf %s "$$" > "$1" && shift && exec "$@"`;
|
|
35
36
|
async function freePort() {
|
|
36
37
|
const srv = createServer();
|
|
37
38
|
srv.listen(0, "127.0.0.1");
|
|
@@ -113,7 +114,9 @@ async function launch(tuiArgv, serveEnv) {
|
|
|
113
114
|
const versionRaw = execFileSync(BIN, ["--version"], { encoding: "utf8" }).trim();
|
|
114
115
|
const line = opencodeLine(versionRaw, BIN);
|
|
115
116
|
mkdirSync(agentHome, { recursive: true });
|
|
116
|
-
const
|
|
117
|
+
const serveArgv = [BIN, "serve", "--hostname", "127.0.0.1", "--port", port];
|
|
118
|
+
const [serveCommand, ...serveArgs] = process.platform === "win32" ? serveArgv : ["/bin/sh", "-c", RECORD_THEN_EXEC, "cotal-serve", pidFile, ...serveArgv];
|
|
119
|
+
const serve = spawn(serveCommand, serveArgs, {
|
|
117
120
|
env: {
|
|
118
121
|
...process.env,
|
|
119
122
|
...serveEnv?.(agentHome),
|
|
@@ -125,7 +128,7 @@ async function launch(tuiArgv, serveEnv) {
|
|
|
125
128
|
},
|
|
126
129
|
stdio: ["ignore", "pipe", "pipe"]
|
|
127
130
|
});
|
|
128
|
-
writeFileSync(pidFile, String(serve.pid));
|
|
131
|
+
if (process.platform === "win32") writeFileSync(pidFile, String(serve.pid));
|
|
129
132
|
serve.on("exit", () => rmSync(pidFile, { force: true }));
|
|
130
133
|
let sessionId;
|
|
131
134
|
let attached = false;
|