@cotal-ai/connector-opencode 0.77.1 → 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 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";
@@ -14869,7 +14869,7 @@ function date4(params) {
14869
14869
  config(en_default());
14870
14870
 
14871
14871
  // ../connector-core/dist/tool-specs.js
14872
- import { isConcreteChannel as isConcreteChannel3, channelInAllow as channelInAllow3, AmbiguousPeerError, peerLabel as peerLabel4, assertLifecycleToken as assertLifecycleToken3, isPermissionDenied as isPermissionDenied2, renderLifecycleBlocked as renderLifecycleBlocked2, EpEnvelopeError as EpEnvelopeError2, LANG_PROBLEM_DETAIL_KIND, formatAge, presenceAges } from "@cotal-ai/core";
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";
14873
14873
 
14874
14874
  // ../connector-core/dist/orientation.js
14875
14875
  import { peerLabel as peerLabel3 } from "@cotal-ai/core";
@@ -1 +1 @@
1
- {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,GAAG,QAAuB,CAAC;AA2ExC;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,CAqJjF"}
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 serve = spawn(BIN, ["serve", "--hostname", "127.0.0.1", "--port", port], {
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;