@overdeck/contracts 0.92.0 → 0.92.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/index.cjs CHANGED
@@ -3820,7 +3820,12 @@ const ChatMessage = effect.Schema.Struct({
3820
3820
  createdAt: effect.Schema.String,
3821
3821
  completedAt: effect.Schema.optional(effect.Schema.String),
3822
3822
  streaming: effect.Schema.optional(effect.Schema.Boolean),
3823
- sequence: effect.Schema.optional(effect.Schema.Number)
3823
+ sequence: effect.Schema.optional(effect.Schema.Number),
3824
+ /** True on a user row that is a self-contained completed local command (e.g. a
3825
+ * Claude Code built-in slash command like `/effort high`) rather than an open
3826
+ * prompt — working-state heuristics must not treat it as an in-flight turn
3827
+ * (PAN-5690 review: D4 amendment). */
3828
+ localCommand: effect.Schema.optional(effect.Schema.Boolean)
3824
3829
  });
3825
3830
  const WorkLogEntry = effect.Schema.Struct({
3826
3831
  id: effect.Schema.String,
@@ -6311,6 +6316,24 @@ const FlywheelLastTick = effect.Schema.Struct({
6311
6316
  /** The needs-you line split into items, each with its first-raised tick (PAN-5198). */
6312
6317
  needsYouItems: effect.Schema.optional(effect.Schema.Array(FlywheelNeedsYouItem))
6313
6318
  });
6319
+ /**
6320
+ * The run before this one (PAN-5666): the newest retired `conv-flywheel~…`
6321
+ * conversation that wrote a tick marker. `pan flywheel start` retires the
6322
+ * previous row instead of deleting it, so its last tick, in-flight list and
6323
+ * open needs-you items survive a fresh start, a crash or a reboot.
6324
+ */
6325
+ const FlywheelPreviousRun = effect.Schema.Struct({
6326
+ conversation: effect.Schema.Struct({
6327
+ /** The retired name, `conv-flywheel~<id8>`. */
6328
+ name: effect.Schema.String,
6329
+ id: effect.Schema.Number,
6330
+ createdAt: effect.Schema.String,
6331
+ endedAt: effect.Schema.NullOr(effect.Schema.String)
6332
+ }),
6333
+ lastTick: FlywheelLastTick,
6334
+ /** The last tick was `phase=stopping`: the run wrote its report and ended. */
6335
+ stoppedCleanly: effect.Schema.Boolean
6336
+ });
6314
6337
  const FlywheelPolicies = effect.Schema.Struct({
6315
6338
  auto_pickup_backlog: effect.Schema.Boolean,
6316
6339
  require_uat_before_merge: effect.Schema.Boolean,
@@ -6509,6 +6532,8 @@ const FlywheelDerivedStatus = effect.Schema.Struct({
6509
6532
  run: FlywheelRunState,
6510
6533
  conversation: effect.Schema.NullOr(FlywheelConversationSummary),
6511
6534
  lastTick: effect.Schema.NullOr(FlywheelLastTick),
6535
+ /** The previous run's last tick (PAN-5666); absent from payloads older than it. */
6536
+ previousRun: effect.Schema.optional(effect.Schema.NullOr(FlywheelPreviousRun)),
6512
6537
  freshness: effect.Schema.NullOr(FlywheelFreshness),
6513
6538
  policies: FlywheelPolicies,
6514
6539
  inFlight: effect.Schema.Array(FlywheelInFlightRow),
@@ -6526,6 +6551,32 @@ const FlywheelDerivedStatus = effect.Schema.Struct({
6526
6551
  health: effect.Schema.optional(FlywheelHealth),
6527
6552
  shipped: effect.Schema.optional(FlywheelShipped)
6528
6553
  });
6554
+ /**
6555
+ * The tick whose needs-you items the page and `pan flywheel status` show
6556
+ * (PAN-5666). The current run's newest tick is the authority once it exists:
6557
+ * the loop carries every open item forward verbatim, and an item it drops is
6558
+ * resolved. Before that first tick, the previous run's items stay open. Their
6559
+ * message ids are dropped because they point into the previous transcript.
6560
+ */
6561
+ function needsYouTick(status) {
6562
+ if (status.lastTick) return status.lastTick;
6563
+ const previous = status.previousRun?.lastTick;
6564
+ if (!previous) return null;
6565
+ return {
6566
+ tick: previous.tick,
6567
+ pick: previous.pick,
6568
+ phase: previous.phase,
6569
+ inFlight: previous.inFlight,
6570
+ needsYou: previous.needsYou,
6571
+ at: previous.at,
6572
+ ...previous.needsYouItems ? { needsYouItems: previous.needsYouItems.map((item) => ({
6573
+ text: item.text,
6574
+ firstRaisedTick: item.firstRaisedTick,
6575
+ firstRaisedAt: item.firstRaisedAt,
6576
+ ...item.context ? { context: item.context } : {}
6577
+ })) } : {}
6578
+ };
6579
+ }
6529
6580
  /** Cards on the Deploy and Done-today lanes. */
6530
6581
  function shippedCardCount(status) {
6531
6582
  return status.shipped?.merges.length ?? 0;
@@ -7704,6 +7755,7 @@ const TELEMETRY_CHANNEL_ROUTES = [
7704
7755
  /** PAN-5083: the Overdeck MCP tool names (ALL_TOOLS in src/lib/mcp/server.ts); a unit test keeps them in step. */
7705
7756
  const TELEMETRY_MCP_TOOLS = [
7706
7757
  "add_order_book_issues",
7758
+ "add_skill_pack",
7707
7759
  "add_skills",
7708
7760
  "answer_agent_permission",
7709
7761
  "answer_agent_plan",
@@ -7735,10 +7787,12 @@ const TELEMETRY_MCP_TOOLS = [
7735
7787
  "list_pending_input",
7736
7788
  "list_pull_request_watches",
7737
7789
  "list_scheduled",
7790
+ "list_skill_packs",
7738
7791
  "list_workers",
7739
7792
  "memory_add",
7740
7793
  "memory_search",
7741
7794
  "preview_order_book_brief",
7795
+ "preview_skill_pack",
7742
7796
  "read_conversation",
7743
7797
  "remove_order_book_issue",
7744
7798
  "request_secret",
@@ -7748,6 +7802,7 @@ const TELEMETRY_MCP_TOOLS = [
7748
7802
  "search_conversations",
7749
7803
  "secret_wait",
7750
7804
  "send_message",
7805
+ "set_skill_pack",
7751
7806
  "start_conversation",
7752
7807
  "start_issue",
7753
7808
  "start_order_book",
@@ -7922,6 +7977,10 @@ const TELEMETRY_CLIENT_ROUTES = [
7922
7977
  "/api/shutdown/force-all",
7923
7978
  "/api/shutdown/force-stop",
7924
7979
  "/api/shutdown/preview",
7980
+ "/api/skills/overrides",
7981
+ "/api/skills/packs",
7982
+ "/api/skills/packs/available",
7983
+ "/api/skills/packs/preview",
7925
7984
  "/api/telemetry/client-config",
7926
7985
  "/api/ui/open",
7927
7986
  "/api/versions/self",
@@ -22578,6 +22637,134 @@ function resolvePathRoot(absPath, projects, scratch) {
22578
22637
  } : { kind: "outside" };
22579
22638
  }
22580
22639
  //#endregion
22640
+ //#region src/settings-secrets.ts
22641
+ /**
22642
+ * PAN-5695: how `GET /api/settings` shows a stored secret (a provider API key or a tracker token)
22643
+ * without returning it, and how a save recognises that it was left unchanged.
22644
+ *
22645
+ * A stored secret is shown as SECRET_MASK followed by its last four characters (none when the
22646
+ * secret is shorter than 16 characters). A whole environment reference (`$OPENAI_API_KEY`) is not
22647
+ * a secret and is shown as is. A save that sends back exactly that shape (SECRET_MASK plus at most
22648
+ * four characters) keeps the stored value; any other value that contains the mask character is an
22649
+ * edited mask and is refused, so a key typed after the mask is never silently dropped.
22650
+ */
22651
+ const SECRET_MASK_CHAR = "•";
22652
+ const SECRET_MASK = "•".repeat(8);
22653
+ const SHOW_TAIL_FROM_LENGTH = 16;
22654
+ /** A whole environment reference (`$VAR` or `${VAR}`), which is shown as written. */
22655
+ const ENV_REFERENCE = /^\$(?:[A-Z_][A-Z0-9_]*|\{[A-Z_][A-Z0-9_]*\})$/;
22656
+ /** True for a whole environment reference (`$VAR` or `${VAR}`). */
22657
+ function isEnvReference(value) {
22658
+ return typeof value === "string" && ENV_REFERENCE.test(value);
22659
+ }
22660
+ /** The masked form of `value`; empty and missing values and whole `$VAR` references are returned as they are. */
22661
+ function maskSecret(value) {
22662
+ if (!value || ENV_REFERENCE.test(value)) return value;
22663
+ return SECRET_MASK + (value.length >= SHOW_TAIL_FROM_LENGTH ? value.slice(-4) : "");
22664
+ }
22665
+ /** True for exactly the shape maskSecret produces: SECRET_MASK plus at most four characters. */
22666
+ function isSecretMask(value) {
22667
+ return typeof value === "string" && value.startsWith(SECRET_MASK) && value.length <= SECRET_MASK.length + 4 && !value.slice(SECRET_MASK.length).includes("•");
22668
+ }
22669
+ /** True for a value that contains the mask character but is not an unchanged mask: an edited mask. */
22670
+ function isEditedSecretMask(value) {
22671
+ return typeof value === "string" && value.includes("•") && !isSecretMask(value);
22672
+ }
22673
+ /**
22674
+ * The Settings inputs show a stored secret as its mask. The first edit replaces the mask: typing
22675
+ * after it starts a new value with the typed text, deleting any of it clears the field, and a
22676
+ * paste over it is the pasted value. A field that is not masked changes as usual.
22677
+ */
22678
+ function nextSecretInput(current, next) {
22679
+ if (!isSecretMask(current)) return next;
22680
+ if (next.startsWith(current)) return next.slice(current.length);
22681
+ if (next.includes("•")) return "";
22682
+ return next;
22683
+ }
22684
+ /** Tracker settings that are not secrets: shown as they are. */
22685
+ const NON_SECRET_TRACKER_FIELDS = new Set(["jira_email", "jira_base_url"]);
22686
+ function mapSecrets(map, isSecret, fn) {
22687
+ if (!map) return void 0;
22688
+ const out = {};
22689
+ for (const [key, value] of Object.entries(map)) {
22690
+ const next = isSecret(key) ? fn(key, value) : value;
22691
+ if (next !== void 0) out[key] = next;
22692
+ }
22693
+ return out;
22694
+ }
22695
+ const allSecret = () => true;
22696
+ /** `map[key]` only for an own property, so `__proto__` or `constructor` never reads the prototype. */
22697
+ const ownValue = (map, key) => Object.hasOwn(map, key) ? map[key] : void 0;
22698
+ /** The `tracker_keys` names the settings API accepts. */
22699
+ const TRACKER_KEY_FIELDS = new Set([
22700
+ "linear",
22701
+ "github",
22702
+ "gitlab",
22703
+ "rally",
22704
+ "jira",
22705
+ "jira_email",
22706
+ "jira_base_url"
22707
+ ]);
22708
+ /** One error per `tracker_keys` name the settings API does not know. */
22709
+ function unknownTrackerKeyErrors(settings) {
22710
+ return Object.keys(settings.tracker_keys ?? {}).filter((key) => !TRACKER_KEY_FIELDS.has(key)).map((key) => `Unknown tracker key: tracker_keys.${key}`);
22711
+ }
22712
+ const trackerSecret = (key) => !NON_SECRET_TRACKER_FIELDS.has(key);
22713
+ /**
22714
+ * A copy of `settings` with every secret masked. A secret config.yaml holds as a whole `$VAR`
22715
+ * reference (`references`) is shown as that reference instead of its resolved value.
22716
+ */
22717
+ function maskSettingsSecrets(settings, references = {}) {
22718
+ const apiRefs = references.apiKeys ?? {};
22719
+ const trackerRefs = references.trackerKeys ?? {};
22720
+ const show = (refs) => (key, value) => {
22721
+ const reference = ownValue(refs, key);
22722
+ return isEnvReference(reference) ? reference : maskSecret(value);
22723
+ };
22724
+ return {
22725
+ ...settings,
22726
+ api_keys: mapSecrets(settings.api_keys, allSecret, show(apiRefs)) ?? {},
22727
+ ...settings.tracker_keys ? { tracker_keys: mapSecrets(settings.tracker_keys, trackerSecret, show(trackerRefs)) } : {}
22728
+ };
22729
+ }
22730
+ /**
22731
+ * A copy of `settings` ready to save:
22732
+ * - a secret config.yaml holds as a whole `$VAR` reference stays that reference when the save
22733
+ * sends its mask or its resolved value (PAN-5738: the save did not change it);
22734
+ * - any other unchanged mask becomes the stored value, or is dropped when nothing is stored.
22735
+ * `stored` holds the resolved values; `references` the raw references.
22736
+ */
22737
+ function restoreMaskedSecrets(settings, stored, references = {}) {
22738
+ const restore = (storedMap, refs) => (key, value) => {
22739
+ const reference = ownValue(refs, key);
22740
+ const storedValue = ownValue(storedMap, key);
22741
+ if (isEnvReference(reference) && (isSecretMask(value) || value === storedValue)) return reference;
22742
+ return isSecretMask(value) ? storedValue : value;
22743
+ };
22744
+ const storedApi = stored.apiKeys ?? {};
22745
+ const storedTracker = stored.trackerKeys ?? {};
22746
+ return {
22747
+ ...settings,
22748
+ api_keys: mapSecrets(settings.api_keys, allSecret, restore(storedApi, references.apiKeys ?? {})) ?? {},
22749
+ ...settings.tracker_keys ? { tracker_keys: mapSecrets(settings.tracker_keys, trackerSecret, restore(storedTracker, references.trackerKeys ?? {})) } : {}
22750
+ };
22751
+ }
22752
+ /** One error per secret whose value is an edited mask (the mask character plus other text). */
22753
+ function editedSecretMaskErrors(settings) {
22754
+ const errors = [];
22755
+ for (const [block, map] of [["api_keys", settings.api_keys], ["tracker_keys", settings.tracker_keys]]) for (const [key, value] of Object.entries(map ?? {})) if (isEditedSecretMask(value)) errors.push(`${block}.${key} still contains the masked value; clear the field and enter the whole key`);
22756
+ return errors;
22757
+ }
22758
+ /**
22759
+ * The key a key-test endpoint should use: the stored key when the client sent back the mask,
22760
+ * otherwise the key it sent. Null for an edited mask, or a mask with nothing stored.
22761
+ */
22762
+ function resolveSecretInput(sent, stored) {
22763
+ if (isSecretMask(sent)) return stored ?? null;
22764
+ if (isEditedSecretMask(sent)) return null;
22765
+ return sent;
22766
+ }
22767
+ //#endregion
22581
22768
  exports.ACP_BEHAVIOR = ACP_BEHAVIOR;
22582
22769
  exports.ACP_CAPABILITIES = ACP_CAPABILITIES;
22583
22770
  exports.ACTIVITY_COUNT_MAX = ACTIVITY_COUNT_MAX;
@@ -22873,6 +23060,7 @@ exports.FlywheelPipelineItem = FlywheelPipelineItem;
22873
23060
  exports.FlywheelPipelineStatus = FlywheelPipelineStatus;
22874
23061
  exports.FlywheelPipelineVerb = FlywheelPipelineVerb;
22875
23062
  exports.FlywheelPolicies = FlywheelPolicies;
23063
+ exports.FlywheelPreviousRun = FlywheelPreviousRun;
22876
23064
  exports.FlywheelRunId = FlywheelRunId;
22877
23065
  exports.FlywheelRunState = FlywheelRunState;
22878
23066
  exports.FlywheelScope = FlywheelScope;
@@ -22989,6 +23177,7 @@ exports.MergeReadyEvent = MergeReadyEvent;
22989
23177
  exports.ModelOrigin = ModelOrigin;
22990
23178
  exports.ModelOriginEntry = ModelOriginEntry;
22991
23179
  exports.NON_ESSENTIAL_GITHUB_CALLERS = NON_ESSENTIAL_GITHUB_CALLERS;
23180
+ exports.NON_SECRET_TRACKER_FIELDS = NON_SECRET_TRACKER_FIELDS;
22992
23181
  exports.NO_DIRECT_PATH_MESSAGE = NO_DIRECT_PATH_MESSAGE;
22993
23182
  exports.OHMYPI_BEHAVIOR = OHMYPI_BEHAVIOR;
22994
23183
  exports.OHMYPI_CAPABILITIES = OHMYPI_CAPABILITIES;
@@ -23105,6 +23294,8 @@ exports.Role = Role;
23105
23294
  exports.RouteKind = RouteKind;
23106
23295
  exports.RouteSource = RouteSource;
23107
23296
  exports.SCHEDULE_PRESET_DAYS = SCHEDULE_PRESET_DAYS;
23297
+ exports.SECRET_MASK = SECRET_MASK;
23298
+ exports.SECRET_MASK_CHAR = SECRET_MASK_CHAR;
23108
23299
  exports.SHARED_CHANNELS = SHARED_CHANNELS;
23109
23300
  exports.SHARED_PROMPT_MAX_CHARS = SHARED_PROMPT_MAX_CHARS;
23110
23301
  exports.SHARED_SCOPE_KINDS = SHARED_SCOPE_KINDS;
@@ -23185,6 +23376,7 @@ exports.TELEMETRY_PROPERTY_DOMAINS = TELEMETRY_PROPERTY_DOMAINS;
23185
23376
  exports.TERMINAL_BACKEND_NAMES = TERMINAL_BACKEND_NAMES;
23186
23377
  exports.TOOL_BODY_INLINE_MAX_BYTES = TOOL_BODY_INLINE_MAX_BYTES;
23187
23378
  exports.TOOL_BODY_PREVIEW_CHARS = TOOL_BODY_PREVIEW_CHARS;
23379
+ exports.TRACKER_KEY_FIELDS = TRACKER_KEY_FIELDS;
23188
23380
  exports.TerminalCloseRpc = TerminalCloseRpc;
23189
23381
  exports.TerminalOpenRpc = TerminalOpenRpc;
23190
23382
  exports.TerminalOutput = TerminalOutput;
@@ -23242,6 +23434,7 @@ exports.decodeFlywheelDerivedStatus = decodeFlywheelDerivedStatus;
23242
23434
  exports.decodeFlywheelStats = decodeFlywheelStats;
23243
23435
  exports.decodeTimelineCursor = decodeTimelineCursor;
23244
23436
  exports.deriveProjectCi = deriveProjectCi;
23437
+ exports.editedSecretMaskErrors = editedSecretMaskErrors;
23245
23438
  exports.effectiveTerminalPalette = effectiveTerminalPalette;
23246
23439
  exports.encodeFlywheelStats = encodeFlywheelStats;
23247
23440
  exports.encodeSharedMessage = encodeSharedMessage;
@@ -23260,17 +23453,24 @@ exports.isAgentSessionName = isAgentSessionName;
23260
23453
  exports.isChannelReplyKind = isChannelReplyKind;
23261
23454
  exports.isConfiguredPullRequestRepo = isConfiguredPullRequestRepo;
23262
23455
  exports.isConnectPlan = isConnectPlan;
23456
+ exports.isEditedSecretMask = isEditedSecretMask;
23263
23457
  exports.isEffortLevel = isEffortLevel;
23458
+ exports.isEnvReference = isEnvReference;
23264
23459
  exports.isIssueAttention = isIssueAttention;
23265
23460
  exports.isIssueState = isIssueState;
23266
23461
  exports.isProtocolCompatible = isProtocolCompatible;
23462
+ exports.isSecretMask = isSecretMask;
23267
23463
  exports.isSingletonConversation = isSingletonConversation;
23268
23464
  exports.isTerminalBackendName = isTerminalBackendName;
23269
23465
  exports.isTerminalTurnDiffSummaryStatus = isTerminalTurnDiffSummaryStatus;
23270
23466
  exports.laneActivityOf = laneActivityOf;
23271
23467
  exports.linkedConversationName = linkedConversationName;
23468
+ exports.maskSecret = maskSecret;
23469
+ exports.maskSettingsSecrets = maskSettingsSecrets;
23272
23470
  exports.needsYouItemKey = needsYouItemKey;
23471
+ exports.needsYouTick = needsYouTick;
23273
23472
  exports.negotiateHello = negotiateHello;
23473
+ exports.nextSecretInput = nextSecretInput;
23274
23474
  exports.normalizeChannelReplyPayload = normalizeChannelReplyPayload;
23275
23475
  exports.normalizeColorTheme = normalizeColorTheme;
23276
23476
  exports.normalizeHarnessName = normalizeHarnessName;
@@ -23298,7 +23498,9 @@ exports.readableForeground = readableForeground;
23298
23498
  exports.repoFromRemoteUrl = repoFromRemoteUrl;
23299
23499
  exports.resolveEffectivePullRequest = resolveEffectivePullRequest;
23300
23500
  exports.resolvePathRoot = resolvePathRoot;
23501
+ exports.resolveSecretInput = resolveSecretInput;
23301
23502
  exports.resolveTrackerIssueId = resolveTrackerIssueId;
23503
+ exports.restoreMaskedSecrets = restoreMaskedSecrets;
23302
23504
  exports.sharedPromptRefusal = sharedPromptRefusal;
23303
23505
  exports.shippedCardCount = shippedCardCount;
23304
23506
  exports.slugifyThemeId = slugifyThemeId;
@@ -23311,5 +23513,6 @@ exports.toSharedMessage = toSharedMessage;
23311
23513
  exports.trimMemoryObservations = trimMemoryObservations;
23312
23514
  exports.trimTurnDiffSummaries = trimTurnDiffSummaries;
23313
23515
  exports.uiOpenSummary = uiOpenSummary;
23516
+ exports.unknownTrackerKeyErrors = unknownTrackerKeyErrors;
23314
23517
  exports.wirePlanOf = wirePlanOf;
23315
23518
  exports.withPaneLivenessAlias = withPaneLivenessAlias;