@sjawhar/pi-legion-envoy 1.17.1 → 1.17.2
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/envoy.js +18 -6
- package/dist/legion.js +18 -6
- package/dist/skills/dispatch/SKILL.md +2 -1
- package/package.json +1 -1
package/dist/envoy.js
CHANGED
|
@@ -29760,7 +29760,9 @@ var ChildStatusEventPayloadSchema = object({
|
|
|
29760
29760
|
var SubscriptionRemovedEventPayloadSchema = object({
|
|
29761
29761
|
session_id: string2().optional(),
|
|
29762
29762
|
by: object({ kind: string2(), id: string2().optional() }).passthrough().optional(),
|
|
29763
|
-
topics: array(string2()).optional()
|
|
29763
|
+
topics: array(string2()).optional(),
|
|
29764
|
+
pending: boolean2().optional(),
|
|
29765
|
+
request_event_id: number2().int().positive().optional()
|
|
29764
29766
|
});
|
|
29765
29767
|
// ../contracts/src/dispatch-snippet.ts
|
|
29766
29768
|
var HTML_ENTITIES = [
|
|
@@ -31603,6 +31605,11 @@ function asErrorShape(value) {
|
|
|
31603
31605
|
function isJson(response) {
|
|
31604
31606
|
return response.headers.get("content-type")?.includes("application/json") ?? false;
|
|
31605
31607
|
}
|
|
31608
|
+
var DISPATCH_TOOL_DEADLINE_MS = 60000;
|
|
31609
|
+
function requestSignal(signal) {
|
|
31610
|
+
const deadline = AbortSignal.timeout(DISPATCH_TOOL_DEADLINE_MS);
|
|
31611
|
+
return signal === undefined ? deadline : AbortSignal.any([signal, deadline]);
|
|
31612
|
+
}
|
|
31606
31613
|
|
|
31607
31614
|
class DispatchClient {
|
|
31608
31615
|
token;
|
|
@@ -31610,10 +31617,12 @@ class DispatchClient {
|
|
|
31610
31617
|
#baseUrl;
|
|
31611
31618
|
#resolvedIssues = new Map;
|
|
31612
31619
|
#creatingIssues = new Map;
|
|
31613
|
-
|
|
31620
|
+
#signal;
|
|
31621
|
+
constructor(baseUrl, token, fetchImpl = fetch, signal) {
|
|
31614
31622
|
this.token = token;
|
|
31615
31623
|
this.fetchImpl = fetchImpl;
|
|
31616
31624
|
this.#baseUrl = baseUrl.replace(/\/+$/, "");
|
|
31625
|
+
this.#signal = requestSignal(signal);
|
|
31617
31626
|
}
|
|
31618
31627
|
async issue(input) {
|
|
31619
31628
|
return this.#json("POST", ["api", "v1", "issues"], input);
|
|
@@ -31825,6 +31834,7 @@ class DispatchClient {
|
|
|
31825
31834
|
const response = await this.fetchImpl(this.#url(path, query), {
|
|
31826
31835
|
method,
|
|
31827
31836
|
headers,
|
|
31837
|
+
signal: this.#signal,
|
|
31828
31838
|
...body === undefined ? {} : { body: JSON.stringify(body) }
|
|
31829
31839
|
});
|
|
31830
31840
|
return this.#response(response);
|
|
@@ -31833,7 +31843,8 @@ class DispatchClient {
|
|
|
31833
31843
|
const response = await this.fetchImpl(this.#url(path), {
|
|
31834
31844
|
method,
|
|
31835
31845
|
headers: { Accept: "application/json", Authorization: `Bearer ${this.token}` },
|
|
31836
|
-
body
|
|
31846
|
+
body,
|
|
31847
|
+
signal: this.#signal
|
|
31837
31848
|
});
|
|
31838
31849
|
return this.#response(response);
|
|
31839
31850
|
}
|
|
@@ -32298,7 +32309,7 @@ async function executeDispatchTool(input) {
|
|
|
32298
32309
|
const ownerArguments = await resolveOwnerArguments(input.tool, input.args, input.cwd, env, exec);
|
|
32299
32310
|
const args = toolSchema(input.tool).parse(ownerArguments.args);
|
|
32300
32311
|
const actor = toolActor(await resolveOrigin(env, exec, input.cwd), input);
|
|
32301
|
-
const client = new DispatchClient(configUrl, configToken, input.fetchImpl);
|
|
32312
|
+
const client = new DispatchClient(configUrl, configToken, input.fetchImpl, input.signal);
|
|
32302
32313
|
const owner = ownerArguments.owner?.kind === "issue" ? {
|
|
32303
32314
|
kind: "issue",
|
|
32304
32315
|
issue: await ensureIssue(client, ownerArguments.owner.issue, actor)
|
|
@@ -32921,7 +32932,7 @@ class EnvoyApiError extends Error {
|
|
|
32921
32932
|
function createEnvoyClient(config) {
|
|
32922
32933
|
const baseUrl = normalizeEnvoyUrl(config.baseUrl);
|
|
32923
32934
|
const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
32924
|
-
const apiToken = process.env
|
|
32935
|
+
const { ENVOY_TOKEN: apiToken } = process.env;
|
|
32925
32936
|
const request = async (path, init) => {
|
|
32926
32937
|
const url = `${baseUrl}${path}`;
|
|
32927
32938
|
for (let attempt = 0;attempt < 2; attempt += 1) {
|
|
@@ -33683,7 +33694,7 @@ function envoyExtension(pi) {
|
|
|
33683
33694
|
label: spec.name,
|
|
33684
33695
|
description: spec.description,
|
|
33685
33696
|
parameters: dispatchToolSchema(spec, zodSchemaApi(pi.zod)),
|
|
33686
|
-
execute: async (_id, params,
|
|
33697
|
+
execute: async (_id, params, signal, _onUpdate, context) => {
|
|
33687
33698
|
try {
|
|
33688
33699
|
const result = await executeDispatchTool({
|
|
33689
33700
|
tool: spec.name,
|
|
@@ -33693,6 +33704,7 @@ function envoyExtension(pi) {
|
|
|
33693
33704
|
sessionId: context.sessionManager.getSessionId(),
|
|
33694
33705
|
sessionTitle: context.sessionManager.getSessionName?.(),
|
|
33695
33706
|
config: currentDispatchConfig(),
|
|
33707
|
+
signal,
|
|
33696
33708
|
env: process.env
|
|
33697
33709
|
});
|
|
33698
33710
|
return toolSuccess(result.text, result.details);
|
package/dist/legion.js
CHANGED
|
@@ -29760,7 +29760,9 @@ var ChildStatusEventPayloadSchema = object({
|
|
|
29760
29760
|
var SubscriptionRemovedEventPayloadSchema = object({
|
|
29761
29761
|
session_id: string2().optional(),
|
|
29762
29762
|
by: object({ kind: string2(), id: string2().optional() }).passthrough().optional(),
|
|
29763
|
-
topics: array(string2()).optional()
|
|
29763
|
+
topics: array(string2()).optional(),
|
|
29764
|
+
pending: boolean2().optional(),
|
|
29765
|
+
request_event_id: number2().int().positive().optional()
|
|
29764
29766
|
});
|
|
29765
29767
|
// ../contracts/src/dispatch-snippet.ts
|
|
29766
29768
|
var HTML_ENTITIES = [
|
|
@@ -32029,6 +32031,11 @@ function asErrorShape(value) {
|
|
|
32029
32031
|
function isJson(response) {
|
|
32030
32032
|
return response.headers.get("content-type")?.includes("application/json") ?? false;
|
|
32031
32033
|
}
|
|
32034
|
+
var DISPATCH_TOOL_DEADLINE_MS = 60000;
|
|
32035
|
+
function requestSignal(signal) {
|
|
32036
|
+
const deadline = AbortSignal.timeout(DISPATCH_TOOL_DEADLINE_MS);
|
|
32037
|
+
return signal === undefined ? deadline : AbortSignal.any([signal, deadline]);
|
|
32038
|
+
}
|
|
32032
32039
|
|
|
32033
32040
|
class DispatchClient {
|
|
32034
32041
|
token;
|
|
@@ -32036,10 +32043,12 @@ class DispatchClient {
|
|
|
32036
32043
|
#baseUrl;
|
|
32037
32044
|
#resolvedIssues = new Map;
|
|
32038
32045
|
#creatingIssues = new Map;
|
|
32039
|
-
|
|
32046
|
+
#signal;
|
|
32047
|
+
constructor(baseUrl, token, fetchImpl = fetch, signal) {
|
|
32040
32048
|
this.token = token;
|
|
32041
32049
|
this.fetchImpl = fetchImpl;
|
|
32042
32050
|
this.#baseUrl = baseUrl.replace(/\/+$/, "");
|
|
32051
|
+
this.#signal = requestSignal(signal);
|
|
32043
32052
|
}
|
|
32044
32053
|
async issue(input) {
|
|
32045
32054
|
return this.#json("POST", ["api", "v1", "issues"], input);
|
|
@@ -32251,6 +32260,7 @@ class DispatchClient {
|
|
|
32251
32260
|
const response = await this.fetchImpl(this.#url(path, query), {
|
|
32252
32261
|
method,
|
|
32253
32262
|
headers,
|
|
32263
|
+
signal: this.#signal,
|
|
32254
32264
|
...body === undefined ? {} : { body: JSON.stringify(body) }
|
|
32255
32265
|
});
|
|
32256
32266
|
return this.#response(response);
|
|
@@ -32259,7 +32269,8 @@ class DispatchClient {
|
|
|
32259
32269
|
const response = await this.fetchImpl(this.#url(path), {
|
|
32260
32270
|
method,
|
|
32261
32271
|
headers: { Accept: "application/json", Authorization: `Bearer ${this.token}` },
|
|
32262
|
-
body
|
|
32272
|
+
body,
|
|
32273
|
+
signal: this.#signal
|
|
32263
32274
|
});
|
|
32264
32275
|
return this.#response(response);
|
|
32265
32276
|
}
|
|
@@ -32724,7 +32735,7 @@ async function executeDispatchTool(input) {
|
|
|
32724
32735
|
const ownerArguments = await resolveOwnerArguments(input.tool, input.args, input.cwd, env, exec);
|
|
32725
32736
|
const args = toolSchema(input.tool).parse(ownerArguments.args);
|
|
32726
32737
|
const actor = toolActor(await resolveOrigin(env, exec, input.cwd), input);
|
|
32727
|
-
const client = new DispatchClient(configUrl, configToken, input.fetchImpl);
|
|
32738
|
+
const client = new DispatchClient(configUrl, configToken, input.fetchImpl, input.signal);
|
|
32728
32739
|
const owner = ownerArguments.owner?.kind === "issue" ? {
|
|
32729
32740
|
kind: "issue",
|
|
32730
32741
|
issue: await ensureIssue(client, ownerArguments.owner.issue, actor)
|
|
@@ -33347,7 +33358,7 @@ class EnvoyApiError extends Error {
|
|
|
33347
33358
|
function createEnvoyClient(config) {
|
|
33348
33359
|
const baseUrl = normalizeEnvoyUrl(config.baseUrl);
|
|
33349
33360
|
const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
33350
|
-
const apiToken = process.env
|
|
33361
|
+
const { ENVOY_TOKEN: apiToken } = process.env;
|
|
33351
33362
|
const request = async (path, init) => {
|
|
33352
33363
|
const url = `${baseUrl}${path}`;
|
|
33353
33364
|
for (let attempt = 0;attempt < 2; attempt += 1) {
|
|
@@ -34101,7 +34112,7 @@ function envoyExtension(pi) {
|
|
|
34101
34112
|
label: spec.name,
|
|
34102
34113
|
description: spec.description,
|
|
34103
34114
|
parameters: dispatchToolSchema(spec, zodSchemaApi(pi.zod)),
|
|
34104
|
-
execute: async (_id, params,
|
|
34115
|
+
execute: async (_id, params, signal, _onUpdate, context) => {
|
|
34105
34116
|
try {
|
|
34106
34117
|
const result = await executeDispatchTool({
|
|
34107
34118
|
tool: spec.name,
|
|
@@ -34111,6 +34122,7 @@ function envoyExtension(pi) {
|
|
|
34111
34122
|
sessionId: context.sessionManager.getSessionId(),
|
|
34112
34123
|
sessionTitle: context.sessionManager.getSessionName?.(),
|
|
34113
34124
|
config: currentDispatchConfig(),
|
|
34125
|
+
signal,
|
|
34114
34126
|
env: process.env
|
|
34115
34127
|
});
|
|
34116
34128
|
return toolSuccess(result.text, result.details);
|
|
@@ -165,7 +165,8 @@ dispatch_edit_ask({
|
|
|
165
165
|
})
|
|
166
166
|
```
|
|
167
167
|
At least one field besides `ask` is required. Use this only while the same decision remains open: it keeps the prior text in the event
|
|
168
|
-
log
|
|
168
|
+
log and invalidates any answer draft against the prior `edited_at` revision, so the human sees the new wording and explicitly reconfirms.
|
|
169
|
+
An answered or resolved ask cannot be edited. If the decision is moot or superseded, retract the old ask and open a new one.
|
|
169
170
|
|
|
170
171
|
An ask stays open until a human answers, unless its question no longer needs that answer. Retract a moot or superseded question, or
|
|
171
172
|
self-resolve one after finding the answer:
|