spur-board 0.82.0 → 0.83.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/{chunk-DYe3fYra.mjs → chunk-B-1Dlzi3.mjs} +71 -43
- package/dist/{chunk-Crnz5mi7.mjs → chunk-BJFUtQhn.mjs} +4 -7
- package/dist/{chunk-DAMwWWmT.mjs → chunk-Bzb7aI8R.mjs} +1 -2
- package/dist/{chunk-BTeE1cn3.mjs → chunk-Bzr8W83d.mjs} +4 -6
- package/dist/cli.mjs +32 -30
- package/dist/client.mjs +1 -2
- package/dist/daemon.mjs +495 -337
- package/dist/mcp.mjs +9 -9
- package/dist/web/assets/index-DeRzYs4U.js +64 -0
- package/dist/web/index.html +1 -1
- package/package.json +2 -2
- package/skills/spur-board/references/commands.md +1 -1
- package/skills/spur-board/references/how-board-works.md +9 -0
- package/dist/web/assets/index-B7w1UQuL.js +0 -64
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
// ../contracts/src/enums.ts
|
|
3
3
|
/**
|
|
4
4
|
* Built-in board columns in canonical order, left to right. Everything stored or addressed
|
|
5
5
|
* (journal, store, addressee roles) uses the `id`; `name` is display text only.
|
|
@@ -224,8 +224,7 @@ const SLACK_BOT_SCOPES = [
|
|
|
224
224
|
"commands",
|
|
225
225
|
"reactions:write"
|
|
226
226
|
];
|
|
227
|
-
|
|
228
|
-
//#region ../contracts/src/config.ts
|
|
227
|
+
// ../contracts/src/config.ts
|
|
229
228
|
/**
|
|
230
229
|
* The daemon's default loopback port. It sits above 4310-4399, a margin the board keeps for
|
|
231
230
|
* Spur's server port 4310 and the ports from 4311 upward that Spur's MCP port takes. It also
|
|
@@ -993,8 +992,7 @@ function requiredSecretKeys(config) {
|
|
|
993
992
|
const slack = Boolean(config.slack.channels.feed || config.slack.channels.orchestrators);
|
|
994
993
|
return SECRET_ENV_KEYS.filter(({ requiredWhen }) => requiredWhen === "always" || requiredWhen === "jira" && jira || requiredWhen === "slack" && slack).map(({ name }) => name);
|
|
995
994
|
}
|
|
996
|
-
|
|
997
|
-
//#region ../contracts/src/errors.ts
|
|
995
|
+
// ../contracts/src/errors.ts
|
|
998
996
|
/**
|
|
999
997
|
* Process exit codes of the CLI. `notApplied` (3) means the command certainly did not take
|
|
1000
998
|
* effect; `outcomeUnknown` (5) means it may have, so the caller retries with the same key.
|
|
@@ -1330,8 +1328,7 @@ function err(error) {
|
|
|
1330
1328
|
error
|
|
1331
1329
|
};
|
|
1332
1330
|
}
|
|
1333
|
-
|
|
1334
|
-
//#region ../contracts/src/ids.ts
|
|
1331
|
+
// ../contracts/src/ids.ts
|
|
1335
1332
|
/**
|
|
1336
1333
|
* Number in an ID or a task key: at most 15 digits, so it always converts to a safe integer
|
|
1337
1334
|
* and two different IDs never share one number. A longer number is `usage`. It is the shared
|
|
@@ -1479,8 +1476,7 @@ function parseActorId(text) {
|
|
|
1479
1476
|
}
|
|
1480
1477
|
};
|
|
1481
1478
|
}
|
|
1482
|
-
|
|
1483
|
-
//#region ../contracts/src/facts.ts
|
|
1479
|
+
// ../contracts/src/facts.ts
|
|
1484
1480
|
const PR_STATES = [
|
|
1485
1481
|
"open",
|
|
1486
1482
|
"closed",
|
|
@@ -1710,8 +1706,7 @@ const sessionFactsSchema = z.strictObject({
|
|
|
1710
1706
|
...ticketFactsSchema.keyof().options.map((field) => `ticket.${field}`),
|
|
1711
1707
|
...sessionFactsSchema.keyof().options.map((field) => `session.${field}`)
|
|
1712
1708
|
];
|
|
1713
|
-
|
|
1714
|
-
//#region ../contracts/src/adapters.ts
|
|
1709
|
+
// ../contracts/src/adapters.ts
|
|
1715
1710
|
/** What the source answered for one requested entity. */
|
|
1716
1711
|
const ENTITY_STATUSES = [
|
|
1717
1712
|
"ok",
|
|
@@ -1902,8 +1897,7 @@ var AdapterError = class extends Error {
|
|
|
1902
1897
|
this.retryAt = options.retryAt;
|
|
1903
1898
|
}
|
|
1904
1899
|
};
|
|
1905
|
-
|
|
1906
|
-
//#region ../contracts/src/events.ts
|
|
1900
|
+
// ../contracts/src/events.ts
|
|
1907
1901
|
const EVENT_KINDS = [
|
|
1908
1902
|
"head_moved",
|
|
1909
1903
|
"pr_facts_changed",
|
|
@@ -2215,8 +2209,7 @@ z.object({
|
|
|
2215
2209
|
message: `actorRef is set only when actor is agent, not ${event.actor}`
|
|
2216
2210
|
});
|
|
2217
2211
|
});
|
|
2218
|
-
|
|
2219
|
-
//#region ../contracts/src/gateway/schemas.ts
|
|
2212
|
+
// ../contracts/src/gateway/schemas.ts
|
|
2220
2213
|
/** Opaque, gateway-issued reference to a conversation. Core stores it and never parses it. */
|
|
2221
2214
|
const conversationRefSchema = z.string().min(1).brand();
|
|
2222
2215
|
/** Opaque, gateway-issued reference to one message. */
|
|
@@ -2374,8 +2367,7 @@ z.discriminatedUnion("status", [
|
|
|
2374
2367
|
scope: z.enum(FAILURE_SCOPES)
|
|
2375
2368
|
})
|
|
2376
2369
|
]);
|
|
2377
|
-
|
|
2378
|
-
//#region ../contracts/src/error-renderers.ts
|
|
2370
|
+
// ../contracts/src/error-renderers.ts
|
|
2379
2371
|
/** One validated input supplies every transport representation. */
|
|
2380
2372
|
const errorInputSchema = z.strictObject({
|
|
2381
2373
|
code: z.enum(Object.keys(ERRORS)),
|
|
@@ -2454,8 +2446,7 @@ function renderLines(value) {
|
|
|
2454
2446
|
""
|
|
2455
2447
|
].join("\n");
|
|
2456
2448
|
}
|
|
2457
|
-
|
|
2458
|
-
//#region ../contracts/src/ops/define.ts
|
|
2449
|
+
// ../contracts/src/ops/define.ts
|
|
2459
2450
|
/** Who may call an operation. Core evaluates them (#34); the catalog only declares them. */
|
|
2460
2451
|
const GRANTS = [
|
|
2461
2452
|
"operator",
|
|
@@ -2526,8 +2517,7 @@ function defineOperation(spec) {
|
|
|
2526
2517
|
}
|
|
2527
2518
|
};
|
|
2528
2519
|
}
|
|
2529
|
-
|
|
2530
|
-
//#region ../contracts/src/ops/turn-schemas.ts
|
|
2520
|
+
// ../contracts/src/ops/turn-schemas.ts
|
|
2531
2521
|
/** One pull request comment or review a turn handed to its executor. */
|
|
2532
2522
|
const turnHandedSchema = z.strictObject({
|
|
2533
2523
|
...prRefSchema.shape,
|
|
@@ -2593,8 +2583,7 @@ const statusReturnedSchema = z.strictObject({
|
|
|
2593
2583
|
block: blockIdSchema.describe("The code block the return opened."),
|
|
2594
2584
|
findings: z.int().min(0).nullable().describe("Number of review findings the return sent; null when not given.")
|
|
2595
2585
|
});
|
|
2596
|
-
|
|
2597
|
-
//#region ../contracts/src/ops/schemas.ts
|
|
2586
|
+
// ../contracts/src/ops/schemas.ts
|
|
2598
2587
|
/**
|
|
2599
2588
|
* A comment as every output returns it. `untrusted` is always `true`: the text comes from a
|
|
2600
2589
|
* person or an agent, and an agent reading it treats it as data, never as instructions.
|
|
@@ -2822,8 +2811,7 @@ const schemaGetOutputSchema = z.strictObject({
|
|
|
2822
2811
|
outputSchema: jsonSchemaPayload("output")
|
|
2823
2812
|
}).describe("One operation.")).describe("Operations the caller may use.")
|
|
2824
2813
|
}).describe("The operation catalog.");
|
|
2825
|
-
|
|
2826
|
-
//#region ../contracts/src/ops/source-view-schema.ts
|
|
2814
|
+
// ../contracts/src/ops/source-view-schema.ts
|
|
2827
2815
|
const sourceViewSchema = z.strictObject({
|
|
2828
2816
|
pointsLastHour: z.int().nonnegative().optional().describe("Reported source points consumed during the preceding hour."),
|
|
2829
2817
|
source: z.string().min(1).describe("Adapter source identifier."),
|
|
@@ -2841,6 +2829,7 @@ const sourceViewSchema = z.strictObject({
|
|
|
2841
2829
|
resetAt: z.iso.datetime().describe("When the source said it restores the full budget.")
|
|
2842
2830
|
}).nullable().describe("Request budget from the last poll of this source that reported one, or null when none did."),
|
|
2843
2831
|
stale: z.boolean().describe("Whether facts from this source exceed their freshness threshold."),
|
|
2832
|
+
healthySince: z.iso.datetime().nullable().describe("When this source became usable (not blind) in this daemon run: its first non-blind observation since daemon start or since it was last blind. Stale, warming-up or budget-wait spells that did not make it blind do not move it. Null while blind or before that observation. Resets when the daemon restarts; compare with daemon.startedAt."),
|
|
2844
2833
|
warmingUp: z.boolean().describe("Whether this source needs a complete poll in this daemon run.")
|
|
2845
2834
|
}).describe("Freshness and availability of one source.");
|
|
2846
2835
|
errorDetailSchema.extend({
|
|
@@ -2869,6 +2858,28 @@ const statusBindingsSchema = z.strictObject({
|
|
|
2869
2858
|
source: z.enum(ADDRESSEE_SOURCES).describe("config: slack.defaultAddressee; board-wide: the board-wide operator; project: the operator of the first board project, in config order, that lists one.")
|
|
2870
2859
|
}).nullable().describe("Who an orchestrators-channel message without a known @shortName goes to; null when it is left unhandled or answered with the prefixes.")
|
|
2871
2860
|
}).describe("Effective column orchestrators, operators and default Slack addressee.");
|
|
2861
|
+
const hostUsageSchema = (total, available, used) => z.strictObject({
|
|
2862
|
+
totalBytes: z.number().nonnegative().describe(total),
|
|
2863
|
+
availableBytes: z.number().nonnegative().describe(available),
|
|
2864
|
+
usedPercent: z.number().min(0).max(100).describe(used)
|
|
2865
|
+
}).nullable();
|
|
2866
|
+
const hostSchema = z.strictObject({
|
|
2867
|
+
sampledAt: z.iso.datetime().describe("When the daemon took this sample, ISO 8601 UTC. It samples every 30 seconds; reads never take a new sample, so an old value means sampling is stuck."),
|
|
2868
|
+
cpuPercent: z.number().min(0).max(100).nullable().describe("Host CPU busy percent over all cores since the previous sample, one decimal; null on the first sample or when unreadable."),
|
|
2869
|
+
memory: hostUsageSchema("Total host memory in bytes.", "Host memory available for new work without swapping, in bytes.", "Percent of host memory in use: total minus available, over total; one decimal.").describe("Host memory; null when unreadable."),
|
|
2870
|
+
disk: hostUsageSchema("Size of the volume in bytes, root-reserved blocks included.", "Free bytes an unprivileged user can still write, without root-reserved blocks.", "Percent of the volume in use, as df shows it: used over used plus available, without root-reserved blocks; one decimal.").describe("The volume holding the board data; null when unreadable.")
|
|
2871
|
+
}).nullable().describe("Host CPU, memory and data-volume disk usage from the last sample of the daemon; null before the first sample.");
|
|
2872
|
+
const serviceSchema = z.strictObject({
|
|
2873
|
+
service: z.string().min(1).describe("daemon, github, jira, spur, or a chat gateway kind such as slack."),
|
|
2874
|
+
state: z.enum([
|
|
2875
|
+
"healthy",
|
|
2876
|
+
"degraded",
|
|
2877
|
+
"failing"
|
|
2878
|
+
]).describe("failing: a blind source or a gateway that is down; degraded: a source that never completed, is stale, warms up or waits for its rate budget, or a daemon with no completed board tick for over 120 seconds; else healthy. A source service takes its worst source."),
|
|
2879
|
+
since: z.iso.datetime().nullable().describe("Healthy: since when the service has been usable in this daemon run. That is daemon.startedAt for the daemon, the latest healthySince of its sources for github, jira and spur, and for a gateway the end of its last recorded outage or daemon.startedAt, whichever is later. Failing gateway: when the outage started. Otherwise null."),
|
|
2880
|
+
lastGoodAt: z.iso.datetime().nullable().describe("Last sign of work: the last completed board tick for the daemon, the oldest latest observation of its sources for github, jira and spur (null when one has none); null for a gateway."),
|
|
2881
|
+
reason: z.string().nullable().describe("Why the service is not healthy, from its first worst source for github, jira and spur; null when healthy.")
|
|
2882
|
+
}).describe("Health of one service.");
|
|
2872
2883
|
const statusInputSchema = z.strictObject({
|
|
2873
2884
|
project: project$1,
|
|
2874
2885
|
detail: z.boolean().optional().describe("Include full ticket, pull request and session facts; absent means compact rows.")
|
|
@@ -2878,6 +2889,8 @@ const statusOutputSchema = z.strictObject({
|
|
|
2878
2889
|
warmingUp: z.boolean().describe("Whether required sources still need a complete poll."),
|
|
2879
2890
|
spurUnavailable: z.string().nullable().describe("One combined Spur availability line, or null when available."),
|
|
2880
2891
|
hostLoad: z.string().nullable().describe("Host-load episode line, or null when absent."),
|
|
2892
|
+
host: hostSchema,
|
|
2893
|
+
services: z.array(serviceSchema).describe("One health row per service: daemon, each chat gateway, then github, spur and jira when sources lists one. Daemon and gateway rows are board-wide; source services roll up only the sources listed."),
|
|
2881
2894
|
transport: z.array(z.strictObject({
|
|
2882
2895
|
gateway: z.string().min(1).describe("Chat gateway kind."),
|
|
2883
2896
|
state: z.enum(["up", "down"]).describe("down while delivery to any space of the gateway is suspended."),
|
|
@@ -2917,8 +2930,7 @@ const blockAnswerOutputSchema = z.strictObject({
|
|
|
2917
2930
|
block: blockViewSchema,
|
|
2918
2931
|
comment: commentSchema
|
|
2919
2932
|
});
|
|
2920
|
-
|
|
2921
|
-
//#region ../contracts/src/ops/config-view-schema.ts
|
|
2933
|
+
// ../contracts/src/ops/config-view-schema.ts
|
|
2922
2934
|
const configViewSchema = z.strictObject({
|
|
2923
2935
|
projects: z.array(z.strictObject({
|
|
2924
2936
|
id: z.string().min(1).describe("Board project ID."),
|
|
@@ -2947,8 +2959,7 @@ const configViewSchema = z.strictObject({
|
|
|
2947
2959
|
spurUiOrigin: z.url({ protocol: /^https?$/ }).nullable().describe("Origin of the Spur web UI clients link sessions to; null when not configured.")
|
|
2948
2960
|
}).describe("Web origins of the board listener and the Spur UI.")
|
|
2949
2961
|
}).describe("Allowlisted effective configuration without credentials or adapter settings.");
|
|
2950
|
-
|
|
2951
|
-
//#region ../contracts/src/ops/inbox-schemas.ts
|
|
2962
|
+
// ../contracts/src/ops/inbox-schemas.ts
|
|
2952
2963
|
/** One entry of the operator inbox: an operator item, a block addressed to the operator or a turn. */
|
|
2953
2964
|
const inboxEntrySchema = z.strictObject({
|
|
2954
2965
|
id: z.union([
|
|
@@ -2967,8 +2978,7 @@ const inboxEntrySchema = z.strictObject({
|
|
|
2967
2978
|
}).describe("One entry of the operator inbox.");
|
|
2968
2979
|
/** An operator inbox entry cleared, answered or closed in the last 24 hours. */
|
|
2969
2980
|
const inboxHandledSchema = inboxEntrySchema.extend({ handledAt: z.iso.datetime().describe("When it was cleared, answered or closed, ISO 8601 UTC.") }).describe("An operator inbox entry handled in the last 24 hours.");
|
|
2970
|
-
|
|
2971
|
-
//#region ../contracts/src/ops/catalog.ts
|
|
2981
|
+
// ../contracts/src/ops/catalog.ts
|
|
2972
2982
|
/** Longest free text an input takes: comments, questions, answers and reasons. */
|
|
2973
2983
|
const TEXT_MAX = 2e4;
|
|
2974
2984
|
/** Longest project, session or token name an input takes. */
|
|
@@ -3025,6 +3035,13 @@ const daemon = {
|
|
|
3025
3035
|
startedAt: "2026-01-05T08:00:00.000Z",
|
|
3026
3036
|
lastDispatchAt: at
|
|
3027
3037
|
};
|
|
3038
|
+
const daemonService = {
|
|
3039
|
+
service: "daemon",
|
|
3040
|
+
state: "healthy",
|
|
3041
|
+
since: daemon.startedAt,
|
|
3042
|
+
lastGoodAt: at,
|
|
3043
|
+
reason: null
|
|
3044
|
+
};
|
|
3028
3045
|
const task = {
|
|
3029
3046
|
key: "PROJ-123",
|
|
3030
3047
|
project: "web",
|
|
@@ -3217,7 +3234,7 @@ const OPERATIONS = [
|
|
|
3217
3234
|
id: "status.get",
|
|
3218
3235
|
web: true,
|
|
3219
3236
|
kind: "query",
|
|
3220
|
-
description: "List items, freshness
|
|
3237
|
+
description: "List items, freshness, service health, host metrics, tasks with turns and PRs; detail adds facts.",
|
|
3221
3238
|
mcp: {
|
|
3222
3239
|
whenToUse: "Get a board overview.",
|
|
3223
3240
|
whenNotToUse: "Use task_get for one task."
|
|
@@ -3242,6 +3259,21 @@ const OPERATIONS = [
|
|
|
3242
3259
|
warmingUp: true,
|
|
3243
3260
|
spurUnavailable: null,
|
|
3244
3261
|
hostLoad: null,
|
|
3262
|
+
host: {
|
|
3263
|
+
sampledAt: at,
|
|
3264
|
+
cpuPercent: 12.5,
|
|
3265
|
+
memory: {
|
|
3266
|
+
totalBytes: 17179869184,
|
|
3267
|
+
availableBytes: 8589934592,
|
|
3268
|
+
usedPercent: 50
|
|
3269
|
+
},
|
|
3270
|
+
disk: {
|
|
3271
|
+
totalBytes: 107374182400,
|
|
3272
|
+
availableBytes: 64424509440,
|
|
3273
|
+
usedPercent: 40
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3276
|
+
services: [daemonService],
|
|
3245
3277
|
transport: [],
|
|
3246
3278
|
sources: [],
|
|
3247
3279
|
tasks: [{
|
|
@@ -3294,6 +3326,8 @@ const OPERATIONS = [
|
|
|
3294
3326
|
warmingUp: false,
|
|
3295
3327
|
spurUnavailable: null,
|
|
3296
3328
|
hostLoad: null,
|
|
3329
|
+
host: null,
|
|
3330
|
+
services: [daemonService],
|
|
3297
3331
|
transport: [],
|
|
3298
3332
|
sources: [],
|
|
3299
3333
|
tasks: [{
|
|
@@ -4708,8 +4742,7 @@ const OPERATIONS = [
|
|
|
4708
4742
|
}]
|
|
4709
4743
|
})
|
|
4710
4744
|
];
|
|
4711
|
-
|
|
4712
|
-
//#region ../contracts/src/ops/roles.ts
|
|
4745
|
+
// ../contracts/src/ops/roles.ts
|
|
4713
4746
|
const ROLE_GRANTS = {
|
|
4714
4747
|
operator: /* @__PURE__ */ new Set([
|
|
4715
4748
|
"operator",
|
|
@@ -4733,8 +4766,7 @@ const ROLE_GRANTS = {
|
|
|
4733
4766
|
function roleCanUseOperation(operation, role, mode) {
|
|
4734
4767
|
return operation.grants === "any" || operation.grants.some((rule) => ROLE_GRANTS[role].has(rule.grant) && (mode === void 0 || rule.mode === void 0 || rule.mode === mode));
|
|
4735
4768
|
}
|
|
4736
|
-
|
|
4737
|
-
//#region ../contracts/src/ops/snapshot.ts
|
|
4769
|
+
// ../contracts/src/ops/snapshot.ts
|
|
4738
4770
|
/**
|
|
4739
4771
|
* The catalog as plain JSON: grants, exit codes, errors, and every operation with its JSON
|
|
4740
4772
|
* Schemas. Inputs are stored in input mode and also converted in output mode, so a
|
|
@@ -4786,8 +4818,7 @@ async function buildCatalogSnapshot(operations) {
|
|
|
4786
4818
|
...body
|
|
4787
4819
|
};
|
|
4788
4820
|
}
|
|
4789
|
-
|
|
4790
|
-
//#region ../contracts/src/systemd.ts
|
|
4821
|
+
// ../contracts/src/systemd.ts
|
|
4791
4822
|
/**
|
|
4792
4823
|
* systemd user-unit policy shared by the CLI unit writer and the daemon's board tick.
|
|
4793
4824
|
*
|
|
@@ -4806,8 +4837,7 @@ const SYSTEMD_SERVICE_SETTINGS = [
|
|
|
4806
4837
|
"TimeoutStopSec=15s",
|
|
4807
4838
|
"UMask=0077"
|
|
4808
4839
|
];
|
|
4809
|
-
|
|
4810
|
-
//#region ../contracts/src/tokens.ts
|
|
4840
|
+
// ../contracts/src/tokens.ts
|
|
4811
4841
|
/** Longest value each field of an operator token request takes, in characters. */
|
|
4812
4842
|
const TOKEN_REQUEST_LIMITS = {
|
|
4813
4843
|
name: 64,
|
|
@@ -4866,11 +4896,9 @@ const remoteDoctorReportSchema = z.object({
|
|
|
4866
4896
|
version: z.string(),
|
|
4867
4897
|
checks: z.array(z.object(checkShape))
|
|
4868
4898
|
});
|
|
4869
|
-
|
|
4870
|
-
//#region ../contracts/src/index.ts
|
|
4899
|
+
// ../contracts/src/index.ts
|
|
4871
4900
|
/** Exhaustiveness check: call it in the `default` branch of a switch over a union. */
|
|
4872
4901
|
function assertNever(value) {
|
|
4873
4902
|
throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
|
|
4874
4903
|
}
|
|
4875
|
-
//#endregion
|
|
4876
4904
|
export { err as $, prSourceId as A, prFactsSchema as B, userIdSchema as C, AdapterError as D, eventPayloadSchemas as E, REVIEW_STATES as F, JIRA_PROJECT_KEY as G, ringMarker as H, SESSION_HEALTH_STATES as I, encodeActorId as J, REF_NUMBER as K, SESSION_STATUSES as L, sourceCursorSchema as M, trackerSourceId as N, batchSchema as O, PR_STATES as P, ERRORS as Q, isExternalAuthor as R, messageRefSchema as S, VIAS as St, GATE_REASONS as T, sessionFactsSchema as U, prRefSchema as V, ticketFactsSchema as W, parseActorId as X, errorCodeOf as Y, parseRef as Z, renderMcpError as _, COLUMN_IDS as _t, requestHashOf as a, DEFAULT_LINK as at, inboundEventSchema as b, SLACK_BOT_SCOPES as bt, tokenRequestStatusSchema as c, DEFAULT_STAND_PORT_RANGE as ct, buildCatalogSnapshot as d, configBindings as dt, errorContextSchema as et, roleCanUseOperation as f, configSchema as ft, renderJsonError as g, resolveWebOrigin as gt, renderHttpProblem as h, requiredSecretKeys as ht, TOKEN_REQUEST_LIMITS as i, DEFAULT_HTTP_PORT as it, sessionTransitionSchema as j, entityRefSchema as k, BOARD_TICK_MS as l, RESERVED_PROJECT as lt, turnHandedSchema as m, plainHttpAllowed as mt, doctorReportSchema as n, ok as nt, tokenRequestResultSchema as o, DEFAULT_SLACK_APP_NAME as ot, OPERATIONS as p, defaultAddressee as pt, actorIdSchema as q, remoteDoctorReportSchema as r, successEnvelopeSchema as rt, tokenRequestSchema as s, DEFAULT_SLACK_COMMAND as st, assertNever as t, errorEnvelopeSchema as tt, SYSTEMD_SERVICE_SETTINGS as u, boardWideSpurProject as ut, SPACE_IDS as v, DISPATCHER_MODES as vt, EVENT_KINDS as w, interactionRefSchema as x, TASK_HOLDS as xt, conversationRefSchema as y, ITEM_KINDS as yt, parseRingMarker as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { Q as ERRORS, c as tokenRequestStatusSchema, et as errorContextSchema, g as renderJsonError, o as tokenRequestResultSchema, rt as successEnvelopeSchema, tt as errorEnvelopeSchema } from "./chunk-B-1Dlzi3.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
5
5
|
import { request as request$1 } from "node:https";
|
|
6
|
-
|
|
6
|
+
// src/terminal.ts
|
|
7
7
|
/** Show control bytes as text so server data cannot change terminal state. */
|
|
8
8
|
function escapeTerminalControls(text) {
|
|
9
9
|
return Array.from(text, (character) => {
|
|
@@ -11,8 +11,7 @@ function escapeTerminalControls(text) {
|
|
|
11
11
|
return code < 32 || code >= 127 && code <= 159 ? `\\u${code.toString(16).padStart(4, "0")}` : character;
|
|
12
12
|
}).join("");
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
//#region src/exit-codes.ts
|
|
14
|
+
// src/exit-codes.ts
|
|
16
15
|
var CliError = class extends Error {
|
|
17
16
|
code;
|
|
18
17
|
context;
|
|
@@ -54,8 +53,7 @@ function renderCliError(error, json, key) {
|
|
|
54
53
|
["requestId", value.requestId]
|
|
55
54
|
].map(([label, text]) => `${label}: ${escapeTerminalControls(text)}`).join("\n");
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
//#region src/client.ts
|
|
56
|
+
// src/client.ts
|
|
59
57
|
function problemError(status, contentType, body) {
|
|
60
58
|
if (!body || typeof body !== "object") return new CliError("outcome_unknown");
|
|
61
59
|
const problem = body;
|
|
@@ -232,5 +230,4 @@ function requestSkillReload(version, config) {
|
|
|
232
230
|
decode: (response, raw) => decodeResponse(skillReloadOutput, response, raw)
|
|
233
231
|
});
|
|
234
232
|
}
|
|
235
|
-
//#endregion
|
|
236
233
|
export { requestTokenEnrollment as a, renderCliError as c, requestSkillReload as i, escapeTerminalControls as l, fetchTokenStatus as n, CliError as o, requestOperation as r, errorExitCode as s, fetchCatalogVersion as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../contracts/src/urls.ts
|
|
2
2
|
/**
|
|
3
3
|
* The base of an HTTP API at `url`, with one trailing slash, so `new URL('path', base)` keeps a
|
|
4
4
|
* path prefix such as `/api`.
|
|
@@ -6,5 +6,4 @@
|
|
|
6
6
|
function apiBaseUrl(url) {
|
|
7
7
|
return new URL(`${url.replace(/\/$/, "")}/`);
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { apiBaseUrl as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { d as buildCatalogSnapshot, ft as configSchema, mt as plainHttpAllowed, p as OPERATIONS } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { d as buildCatalogSnapshot, ft as configSchema, mt as plainHttpAllowed, p as OPERATIONS } from "./chunk-B-1Dlzi3.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-BJFUtQhn.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import YAML from "yaml";
|
|
9
|
-
|
|
9
|
+
// src/config.ts
|
|
10
10
|
const CONNECT_TIMEOUT_MS = 2e3;
|
|
11
11
|
const RESPONSE_TIMEOUT_MS = 3e4;
|
|
12
12
|
/** A relative `BOARD_HOME` counts from `cwd`; relative XDG directories are ignored. */
|
|
@@ -146,8 +146,7 @@ function loadEnrollmentConfig(env = process.env) {
|
|
|
146
146
|
responseTimeoutMs: RESPONSE_TIMEOUT_MS
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
//#region src/version.ts
|
|
149
|
+
// src/version.ts
|
|
151
150
|
let clientVersion;
|
|
152
151
|
/** The catalog version this client was built with; the snapshot is built once per process. */
|
|
153
152
|
function clientCatalogVersion() {
|
|
@@ -262,5 +261,4 @@ function fileVerdictCache(path, cliVersion) {
|
|
|
262
261
|
return verdict;
|
|
263
262
|
} };
|
|
264
263
|
}
|
|
265
|
-
//#endregion
|
|
266
264
|
export { memoryVerdictCache as a, loadClientConfig as c, resolveDaemonAddress as d, tokenInFolder as f, fileVerdictCache as i, loadEnrollmentConfig as l, cliPackageVersion as n, configFile as o, compareCatalogs as r, dataDirectory as s, checkCatalog as t, readConfiguredPort as u };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Q as ERRORS, a as requestHashOf, bt as SLACK_BOT_SCOPES, ct as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, ht as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-
|
|
2
|
-
import { t as apiBaseUrl } from "./chunk-
|
|
3
|
-
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-
|
|
4
|
-
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-
|
|
1
|
+
import { Q as ERRORS, a as requestHashOf, bt as SLACK_BOT_SCOPES, ct as DEFAULT_STAND_PORT_RANGE, f as roleCanUseOperation, ft as configSchema, gt as resolveWebOrigin, ht as requiredSecretKeys, p as OPERATIONS, q as actorIdSchema, r as remoteDoctorReportSchema, rt as successEnvelopeSchema, u as SYSTEMD_SERVICE_SETTINGS } from "./chunk-B-1Dlzi3.mjs";
|
|
2
|
+
import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
|
|
3
|
+
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-BJFUtQhn.mjs";
|
|
4
|
+
import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-Bzr8W83d.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, userInfo } from "node:os";
|
|
@@ -17,7 +17,7 @@ import { createServer } from "node:net";
|
|
|
17
17
|
import { access, cp, lstat, mkdir, readFile, readdir, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
19
|
import { createInterface } from "node:readline/promises";
|
|
20
|
-
|
|
20
|
+
// src/manifest.ts
|
|
21
21
|
function loadSlackManifestDefaults(env, home) {
|
|
22
22
|
let contents;
|
|
23
23
|
try {
|
|
@@ -29,7 +29,10 @@ function loadSlackManifestDefaults(env, home) {
|
|
|
29
29
|
const document = YAML.parseDocument(contents);
|
|
30
30
|
if (document.errors.length > 0) throw new CliError("config", void 0, void 0, "Fix the YAML in config.yaml.");
|
|
31
31
|
const parsed = configSchema.safeParse(document.toJS());
|
|
32
|
-
if (!parsed.success)
|
|
32
|
+
if (!parsed.success) {
|
|
33
|
+
const key = parsed.error.issues[0]?.path.map(String).join(".") || "config.yaml";
|
|
34
|
+
throw new CliError("config", void 0, void 0, `Fix ${key} in config.yaml.`);
|
|
35
|
+
}
|
|
33
36
|
return {
|
|
34
37
|
appName: parsed.data.slack.appName,
|
|
35
38
|
command: parsed.data.slack.command
|
|
@@ -66,8 +69,7 @@ function renderSlackManifest(options = {}) {
|
|
|
66
69
|
}
|
|
67
70
|
}, { lineWidth: 0 });
|
|
68
71
|
}
|
|
69
|
-
|
|
70
|
-
//#region src/port.ts
|
|
72
|
+
// src/port.ts
|
|
71
73
|
/** A private copy of the client's check: client.ts is the published entry, so it exports nothing new. */
|
|
72
74
|
const instanceHeader = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
73
75
|
/** Bind 127.0.0.1:port as the daemon would and close at once; returns the error code, or null when free. */
|
|
@@ -130,8 +132,7 @@ async function checkHttpPort(port, probe) {
|
|
|
130
132
|
if (await isBoardDaemon(port)) return null;
|
|
131
133
|
return `${label} is held by ${await holderOf(port, probe)}. Stop that process or set http.port in config.yaml to a free port, then start the service again.`;
|
|
132
134
|
}
|
|
133
|
-
|
|
134
|
-
//#region src/doctor.ts
|
|
135
|
+
// src/doctor.ts
|
|
135
136
|
function systemRun(command, args, env) {
|
|
136
137
|
const result = spawnSync(command, [...args], {
|
|
137
138
|
encoding: "utf8",
|
|
@@ -640,8 +641,7 @@ function renderDoctor(checks, json) {
|
|
|
640
641
|
return escapeTerminalControls(`${check.status.toUpperCase()} ${check.id}${present}${fix}`);
|
|
641
642
|
}).join("\n");
|
|
642
643
|
}
|
|
643
|
-
|
|
644
|
-
//#region src/service.ts
|
|
644
|
+
// src/service.ts
|
|
645
645
|
const serviceName = "spur-board.service";
|
|
646
646
|
function configHome(env, home) {
|
|
647
647
|
const configured = env["XDG_CONFIG_HOME"];
|
|
@@ -745,11 +745,12 @@ async function requireStart(runner, args, unit) {
|
|
|
745
745
|
enabled: "unknown"
|
|
746
746
|
}));
|
|
747
747
|
const origin = unit.written === void 0 ? "" : unit.written ? " (written by this run)" : " (already in place)";
|
|
748
|
-
|
|
748
|
+
const hint = [
|
|
749
749
|
`Unit file ${unit.file}${origin} is ${state.enabled}; the service is ${state.active}.`,
|
|
750
750
|
`systemctl ${args.join(" ")} failed: ${detail}.`,
|
|
751
751
|
"Read why with `journalctl --user -u spur-board.service -n 100` and run `board doctor`."
|
|
752
|
-
].join(" ")
|
|
752
|
+
].join(" ");
|
|
753
|
+
throw new CliError("service_start_failed", void 0, void 0, hint);
|
|
753
754
|
}
|
|
754
755
|
async function preflight(paths) {
|
|
755
756
|
for (const [label, path] of [["Node executable", paths.nodePath], ["daemon entry", paths.daemonEntry]]) {
|
|
@@ -870,10 +871,10 @@ async function uninstallService(options = {}) {
|
|
|
870
871
|
await requireSuccess(runner, "systemctl", ["--user", "daemon-reload"]);
|
|
871
872
|
return { changed: true };
|
|
872
873
|
}
|
|
873
|
-
|
|
874
|
-
//#region src/skill-reload.ts
|
|
874
|
+
// src/skill-reload.ts
|
|
875
875
|
function reasonOf(error) {
|
|
876
|
-
|
|
876
|
+
const reason = error instanceof CliError ? error.hint ?? ERRORS[error.code].message : error instanceof Error ? error.message : "unexpected error";
|
|
877
|
+
return escapeTerminalControls(reason).replace(/\.$/, "");
|
|
877
878
|
}
|
|
878
879
|
/**
|
|
879
880
|
* Asks the daemon to message running sessions about a new skill version. It never throws: the
|
|
@@ -886,20 +887,20 @@ async function askSessionsToReload(options) {
|
|
|
886
887
|
if (port === void 0 || port === 0) return;
|
|
887
888
|
}
|
|
888
889
|
try {
|
|
889
|
-
const
|
|
890
|
+
const config = {
|
|
890
891
|
address: resolveDaemonAddress(env, home),
|
|
891
892
|
session: void 0,
|
|
892
893
|
token: void 0,
|
|
893
894
|
connectTimeoutMs: 2e3,
|
|
894
895
|
responseTimeoutMs: 1e4
|
|
895
|
-
}
|
|
896
|
+
};
|
|
897
|
+
const { queued } = await requestSkillReload(version, config);
|
|
896
898
|
if (queued > 0) stderr(`Asked ${String(queued)} running session(s) to re-read the spur-board skill.\n`);
|
|
897
899
|
} catch (error) {
|
|
898
900
|
stderr(`Running sessions were not asked to re-read the spur-board skill: ${reasonOf(error)}. \`board doctor\` lists them under sessions.stale.\n`);
|
|
899
901
|
}
|
|
900
902
|
}
|
|
901
|
-
|
|
902
|
-
//#region src/skills.ts
|
|
903
|
+
// src/skills.ts
|
|
903
904
|
const stampName = ".spur-board-install.json";
|
|
904
905
|
const installId = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
905
906
|
const skills = [{
|
|
@@ -988,12 +989,14 @@ async function createMissingParents(paths) {
|
|
|
988
989
|
}
|
|
989
990
|
async function withInstallLock(home, env, action) {
|
|
990
991
|
const configured = env["XDG_STATE_HOME"];
|
|
991
|
-
const
|
|
992
|
+
const stateHome = configured && isAbsolute(configured) ? configured : join(home, ".local", "state");
|
|
993
|
+
const stateDir = join(stateHome, "spur-board");
|
|
992
994
|
await mkdir(stateDir, {
|
|
993
995
|
recursive: true,
|
|
994
996
|
mode: 448
|
|
995
997
|
});
|
|
996
|
-
const
|
|
998
|
+
const file = join(stateDir, "skills-install.lock");
|
|
999
|
+
const fd = openSync(file, constants.O_CREAT | constants.O_RDWR | constants.O_NOFOLLOW, 384);
|
|
997
1000
|
try {
|
|
998
1001
|
await new Promise((resolveLock, reject) => {
|
|
999
1002
|
const child = spawn("flock", [
|
|
@@ -1078,9 +1081,10 @@ async function recoverSkill(parent, destination, name) {
|
|
|
1078
1081
|
async function installIntoHome(home, packageRoot, version, options, env) {
|
|
1079
1082
|
const targets = await Promise.all(agents.map(async (agent) => {
|
|
1080
1083
|
const configured = agent === ".codex" ? env["CODEX_HOME"] : void 0;
|
|
1084
|
+
const root = configured ? resolve(configured) : join(home, agent);
|
|
1081
1085
|
return {
|
|
1082
1086
|
agent,
|
|
1083
|
-
...await resolvedParent(join(
|
|
1087
|
+
...await resolvedParent(join(root, "skills"))
|
|
1084
1088
|
};
|
|
1085
1089
|
}));
|
|
1086
1090
|
for (const { parent } of targets) for (const skill of skills) await targetDirectory(join(parent, skill.name));
|
|
@@ -1120,7 +1124,8 @@ async function installIntoHome(home, packageRoot, version, options, env) {
|
|
|
1120
1124
|
const backup = join(parent, `.${skill.name}-backup-${backupId}`);
|
|
1121
1125
|
const backupOwner = `${backup}.owner`;
|
|
1122
1126
|
const original = await lstat(destination, { bigint: true });
|
|
1123
|
-
|
|
1127
|
+
const identity = `${String(original.dev)}:${String(original.ino)}`;
|
|
1128
|
+
await writeFile(backupOwner, `spur-board backup ${backupId} ${identity}\n`, {
|
|
1124
1129
|
flag: "wx",
|
|
1125
1130
|
mode: 384
|
|
1126
1131
|
});
|
|
@@ -1166,8 +1171,7 @@ async function installSkills(options = {}) {
|
|
|
1166
1171
|
await Promise.all(skills.map((skill) => requireSource(join(packageRoot, "skills", skill.source))));
|
|
1167
1172
|
return withInstallLock(home, env, () => installIntoHome(home, packageRoot, version, options, env));
|
|
1168
1173
|
}
|
|
1169
|
-
|
|
1170
|
-
//#region src/update.ts
|
|
1174
|
+
// src/update.ts
|
|
1171
1175
|
const stateSchema = z.object({
|
|
1172
1176
|
schema: z.literal(1),
|
|
1173
1177
|
status: z.enum([
|
|
@@ -2058,8 +2062,7 @@ async function rollback(updater, options, yes) {
|
|
|
2058
2062
|
operator: [MCP_LINE]
|
|
2059
2063
|
};
|
|
2060
2064
|
}
|
|
2061
|
-
|
|
2062
|
-
//#region src/cli.ts
|
|
2065
|
+
// src/cli.ts
|
|
2063
2066
|
const processIo = {
|
|
2064
2067
|
stdout: (text) => process.stdout.write(text),
|
|
2065
2068
|
stderr: (text) => process.stderr.write(text),
|
|
@@ -2530,5 +2533,4 @@ async function runCli(argv, options = {}) {
|
|
|
2530
2533
|
return errorExitCode(cliError);
|
|
2531
2534
|
}
|
|
2532
2535
|
}
|
|
2533
|
-
//#endregion
|
|
2534
2536
|
export { createProgram, exampleCommand, runCli };
|
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
|
|
1
|
+
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-BJFUtQhn.mjs";
|