@sjawhar/opencode-legion-envoy 0.10.0 → 0.11.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.
Files changed (2) hide show
  1. package/dist/src/server.js +27 -20
  2. package/package.json +1 -1
@@ -4730,11 +4730,25 @@ function superRefine(fn) {
4730
4730
  }
4731
4731
  // ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
4732
4732
  config(en_default());
4733
+ // ../contracts/src/dispatch-question.ts
4734
+ var DispatchQuestionOptionSchema = strictObject({
4735
+ label: string2().min(1),
4736
+ description: string2().optional()
4737
+ });
4738
+ var DispatchQuestionSchema = strictObject({
4739
+ askId: string2().optional(),
4740
+ question: string2().min(1),
4741
+ header: string2().optional(),
4742
+ options: array(DispatchQuestionOptionSchema).optional(),
4743
+ multiple: boolean2().optional(),
4744
+ custom: boolean2().optional()
4745
+ });
4746
+ var DispatchQuestionInputSchema = DispatchQuestionSchema.omit({ askId: true });
4733
4747
  // ../contracts/src/envelope.ts
4734
4748
  var isSubject = (value) => typeof value === "string" && value.length > 0;
4735
4749
  var EnvelopeSchema = object({
4736
4750
  event_id: string2().min(1),
4737
- source: _enum(["agent", "envoy", "github", "slack", "whatsapp", "ghostwispr"]),
4751
+ source: _enum(["agent", "human", "envoy", "github", "slack", "whatsapp", "ghostwispr"]),
4738
4752
  source_event_id: string2().min(1),
4739
4753
  source_session: string2().optional(),
4740
4754
  topic: custom(isSubject, { message: "topic must be a non-empty subject" }),
@@ -5043,25 +5057,13 @@ var DISPATCH_ARGUMENTS = {
5043
5057
  repo: "owner/name. Opening a thread only; defaults to the working directory's GitHub repo.",
5044
5058
  parent: "<n> | owner/name#<n>[#<commentId>]. Opening a thread only: link the thread as a sub-issue of an existing issue and append a breadcrumb to the comment."
5045
5059
  };
5046
-
5047
5060
  class DispatchArgumentError extends Error {
5048
5061
  name = "DispatchArgumentError";
5049
5062
  }
5050
- var QuestionOptionSchema = strictObject({
5051
- label: string2().min(1),
5052
- description: string2().optional()
5053
- });
5054
- var DispatchQuestionSchema = strictObject({
5055
- question: string2().min(1),
5056
- header: string2().optional(),
5057
- options: array(QuestionOptionSchema).optional(),
5058
- multiple: boolean2().optional(),
5059
- custom: boolean2().optional()
5060
- });
5061
5063
  var prose = {
5062
5064
  context: string2(),
5063
5065
  question: string2(),
5064
- ask: array(DispatchQuestionSchema).optional()
5066
+ ask: array(DispatchQuestionInputSchema).optional()
5065
5067
  };
5066
5068
  var OpenThreadCallSchema = strictObject({
5067
5069
  subject: string2(),
@@ -5076,7 +5078,7 @@ var dispatchToolShape = {
5076
5078
  thread: string2().describe(DISPATCH_ARGUMENTS.thread).optional(),
5077
5079
  context: string2().describe(DISPATCH_ARGUMENTS.context),
5078
5080
  question: string2().describe(DISPATCH_ARGUMENTS.question),
5079
- ask: array(DispatchQuestionSchema).describe(DISPATCH_ARGUMENTS.ask).optional(),
5081
+ ask: array(DispatchQuestionInputSchema).describe(DISPATCH_ARGUMENTS.ask).optional(),
5080
5082
  urgency: _enum(DISPATCH_URGENCIES).describe(DISPATCH_ARGUMENTS.urgency).optional(),
5081
5083
  repo: string2().describe(DISPATCH_ARGUMENTS.repo).optional(),
5082
5084
  parent: string2().describe(DISPATCH_ARGUMENTS.parent).optional()
@@ -5184,7 +5186,7 @@ async function resolveOrigin(env, exec, cwd) {
5184
5186
  cwd,
5185
5187
  machine: machineID()
5186
5188
  };
5187
- const pane = env["TMUX_PANE"];
5189
+ const pane = env.TMUX_PANE;
5188
5190
  if (pane) {
5189
5191
  const output = await tryExec(exec, "tmux", ["display-message", "-p", "-t", pane, "#S:#I.#P #{pane_id}"], cwd);
5190
5192
  const [target, paneId] = output?.trim().split(" ") ?? [];
@@ -5378,10 +5380,10 @@ function readEnvoyFile(filePath) {
5378
5380
  return { kind: "valid", settings: parsed.data.dispatch ?? null };
5379
5381
  }
5380
5382
  function resolveDispatchConfig(env, options = {}) {
5381
- const explicit = env["DISPATCH_MCP_URL"];
5383
+ const explicit = env.DISPATCH_MCP_URL;
5382
5384
  if (explicit)
5383
5385
  return { url: explicit, error: null };
5384
- const home = options.home ?? env["HOME"] ?? homedir();
5386
+ const home = options.home ?? env.HOME ?? homedir();
5385
5387
  const cwd = options.cwd ?? process.cwd();
5386
5388
  const userFile = readEnvoyFile(path.join(home, ".config", "opencode", "envoy.json"));
5387
5389
  const repoFile = readEnvoyFile(path.join(cwd, ".opencode", "envoy.json"));
@@ -5563,18 +5565,23 @@ function createEnvoyClient(config) {
5563
5565
  },
5564
5566
  getInterest: async (sessionID) => InterestWireSchema.parse(JSON.parse(await request(`/v1/interests/${sessionID}`, {}))),
5565
5567
  send: async (input) => toEnvelope(await post("/v1/messages/send", {
5566
- source_session: input.sourceSessionID,
5568
+ source: input.source ?? "agent",
5569
+ ...input.sourceSessionID === undefined ? {} : { source_session: input.sourceSessionID },
5567
5570
  target_session: input.targetSessionID,
5568
5571
  message: input.message,
5569
5572
  ...input.idempotencyKey === undefined ? {} : { idempotency_key: input.idempotencyKey }
5570
5573
  })),
5571
5574
  publish: async (input) => toEnvelope(await post("/v1/messages/publish", {
5572
- source_session: input.sourceSessionID,
5575
+ source: input.source ?? "agent",
5576
+ ...input.sourceSessionID === undefined ? {} : { source_session: input.sourceSessionID },
5573
5577
  topic: input.topic,
5574
5578
  message: input.message,
5575
5579
  ...input.payload === undefined ? {} : { payload: input.payload },
5576
5580
  ...input.idempotencyKey === undefined ? {} : { idempotency_key: input.idempotencyKey }
5577
5581
  })),
5582
+ unregisterSession: async (sessionID) => {
5583
+ await request(`/v1/sessions/${encodeURIComponent(sessionID)}`, { method: "DELETE" });
5584
+ },
5578
5585
  setRole: async (input) => InterestWireSchema.parse(JSON.parse(await post("/v1/roles/set", { session_id: input.sessionID, role: input.role }))),
5579
5586
  listSessions: async () => SessionWireSchema.array().parse(JSON.parse(await request("/v1/sessions", {})))
5580
5587
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "main": "dist/src/server.js",
6
6
  "exports": {