@skrr-ai/cli 0.1.14 → 0.1.17

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 (107) hide show
  1. package/README.md +3 -0
  2. package/dist/base-command.d.ts +14 -0
  3. package/dist/base-command.js +60 -1
  4. package/dist/commands/agents/create.d.ts +1 -0
  5. package/dist/commands/agents/create.js +6 -1
  6. package/dist/commands/agents/instructions/add.d.ts +21 -0
  7. package/dist/commands/agents/instructions/add.js +115 -0
  8. package/dist/commands/agents/instructions/disable.d.ts +13 -0
  9. package/dist/commands/agents/instructions/disable.js +50 -0
  10. package/dist/commands/agents/instructions/edit.d.ts +16 -0
  11. package/dist/commands/agents/instructions/edit.js +79 -0
  12. package/dist/commands/agents/instructions/enable.d.ts +13 -0
  13. package/dist/commands/agents/instructions/enable.js +50 -0
  14. package/dist/commands/agents/instructions/move.d.ts +15 -0
  15. package/dist/commands/agents/instructions/move.js +61 -0
  16. package/dist/commands/agents/instructions/preview.d.ts +13 -0
  17. package/dist/commands/agents/instructions/preview.js +59 -0
  18. package/dist/commands/agents/instructions/remove.d.ts +13 -0
  19. package/dist/commands/agents/instructions/remove.js +49 -0
  20. package/dist/commands/agents/instructions/set.d.ts +17 -0
  21. package/dist/commands/agents/instructions/set.js +79 -0
  22. package/dist/commands/agents/instructions/show.d.ts +15 -0
  23. package/dist/commands/agents/instructions/show.js +76 -0
  24. package/dist/commands/agents/instructions/upgrade.d.ts +16 -0
  25. package/dist/commands/agents/instructions/upgrade.js +77 -0
  26. package/dist/commands/agents/show.js +5 -0
  27. package/dist/commands/agents/triggers/policy.js +8 -2
  28. package/dist/commands/agents/update.d.ts +1 -0
  29. package/dist/commands/agents/update.js +8 -2
  30. package/dist/commands/commitments/autonomy.js +9 -1
  31. package/dist/commands/commitments/create.d.ts +8 -5
  32. package/dist/commands/commitments/create.js +38 -8
  33. package/dist/commands/commitments/doctor.d.ts +19 -0
  34. package/dist/commands/commitments/doctor.js +72 -0
  35. package/dist/commands/commitments/preflight.d.ts +3 -1
  36. package/dist/commands/commitments/preflight.js +25 -3
  37. package/dist/commands/commitments/reports.js +15 -2
  38. package/dist/commands/commitments/update.d.ts +9 -2
  39. package/dist/commands/commitments/update.js +36 -2
  40. package/dist/commands/daemon/index.js +2 -0
  41. package/dist/commands/daemon/recover-offline-queue.d.ts +9 -0
  42. package/dist/commands/daemon/recover-offline-queue.js +24 -0
  43. package/dist/commands/daemon/start.js +29 -1
  44. package/dist/commands/instruction-blocks/create.d.ts +19 -0
  45. package/dist/commands/instruction-blocks/create.js +94 -0
  46. package/dist/commands/instruction-blocks/delete.d.ts +13 -0
  47. package/dist/commands/instruction-blocks/delete.js +35 -0
  48. package/dist/commands/instruction-blocks/list.d.ts +13 -0
  49. package/dist/commands/instruction-blocks/list.js +71 -0
  50. package/dist/commands/instruction-blocks/show.d.ts +12 -0
  51. package/dist/commands/instruction-blocks/show.js +35 -0
  52. package/dist/commands/instruction-blocks/update.d.ts +23 -0
  53. package/dist/commands/instruction-blocks/update.js +94 -0
  54. package/dist/commands/spaces/auto-executor/preview.d.ts +1 -0
  55. package/dist/commands/spaces/auto-executor/preview.js +62 -3
  56. package/dist/commands/spaces/auto-executor/update.d.ts +4 -0
  57. package/dist/commands/spaces/auto-executor/update.js +78 -7
  58. package/dist/commands/spaces/capacity.js +14 -2
  59. package/dist/commands/spaces/update.d.ts +4 -0
  60. package/dist/commands/spaces/update.js +49 -2
  61. package/dist/commands/tasks/complete.d.ts +12 -5
  62. package/dist/commands/tasks/complete.js +107 -28
  63. package/dist/commands/tasks/continue-ready.js +9 -1
  64. package/dist/commands/tasks/create.d.ts +1 -0
  65. package/dist/commands/tasks/create.js +27 -2
  66. package/dist/commands/tasks/deliverable/add.d.ts +23 -0
  67. package/dist/commands/tasks/deliverable/add.js +70 -0
  68. package/dist/commands/tasks/deliverable/confirm.d.ts +35 -0
  69. package/dist/commands/tasks/deliverable/confirm.js +77 -0
  70. package/dist/commands/tasks/events/append.d.ts +1 -1
  71. package/dist/commands/tasks/events/append.js +4 -4
  72. package/dist/commands/tasks/expectations.d.ts +12 -0
  73. package/dist/commands/tasks/expectations.js +111 -0
  74. package/dist/commands/tasks/judge.d.ts +29 -0
  75. package/dist/commands/tasks/judge.js +68 -0
  76. package/dist/commands/tasks/report.d.ts +1 -1
  77. package/dist/commands/tasks/report.js +27 -3
  78. package/dist/commands/tasks/trust.d.ts +35 -0
  79. package/dist/commands/tasks/trust.js +75 -0
  80. package/dist/commands/tasks/update.d.ts +1 -0
  81. package/dist/commands/tasks/update.js +34 -4
  82. package/dist/commands/tasks/waive.d.ts +25 -0
  83. package/dist/commands/tasks/waive.js +58 -0
  84. package/dist/lib/agent-config.js +5 -0
  85. package/dist/lib/agent-instructions.d.ts +15 -0
  86. package/dist/lib/agent-instructions.js +55 -0
  87. package/dist/lib/command-hygiene.d.ts +6 -1
  88. package/dist/lib/command-hygiene.js +49 -29
  89. package/dist/lib/commitments.d.ts +28 -3
  90. package/dist/lib/commitments.js +20 -11
  91. package/dist/lib/exec-runtime-binary.d.ts +13 -0
  92. package/dist/lib/exec-runtime-binary.js +45 -0
  93. package/dist/lib/git-task.d.ts +37 -0
  94. package/dist/lib/git-task.js +151 -0
  95. package/dist/lib/instruction-blocks.d.ts +29 -0
  96. package/dist/lib/instruction-blocks.js +159 -0
  97. package/dist/lib/runtime-start-verification.d.ts +49 -0
  98. package/dist/lib/runtime-start-verification.js +108 -0
  99. package/dist/lib/task-execution.d.ts +18 -2
  100. package/dist/lib/task-execution.js +19 -14
  101. package/dist/lib/task-transcript.js +1 -1
  102. package/dist/lib/tasks.d.ts +50 -0
  103. package/dist/lib/tasks.js +93 -2
  104. package/dist/node_modules/@skrr-ai/data-provider/index.js +2393 -2197
  105. package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
  106. package/oclif.manifest.json +17725 -15563
  107. package/package.json +4 -1
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const base_command_1 = require("../../base-command");
6
+ /**
7
+ * `skrr tasks waive <task> <expectation-id> --reason "<why>"`
8
+ *
9
+ * Drop a requirement, on the record. The expectation is KEPT and marked, never
10
+ * deleted: deleting it expresses the same decision while destroying the only
11
+ * evidence that it was ever owed, which is what someone asking "why wasn't this
12
+ * done?" needs to read.
13
+ *
14
+ * The reason is required for the same purpose — a waiver without one is
15
+ * indistinguishable from having forgotten.
16
+ */
17
+ class TasksWaive extends base_command_1.BaseCommand {
18
+ static description = 'Waive an expectation, with a stated reason';
19
+ static examples = [
20
+ '<%= config.bin %> tasks waive <task-id> c1 --reason "superseded by OSK-7000"',
21
+ ];
22
+ static args = {
23
+ task: core_1.Args.string({ description: 'Task id or ref', required: true, ignoreStdin: true }),
24
+ expectation: core_1.Args.string({
25
+ description: 'Expectation id (see `tasks expectations`)',
26
+ required: true,
27
+ ignoreStdin: true,
28
+ }),
29
+ };
30
+ static flags = {
31
+ reason: core_1.Flags.string({
32
+ description: 'Why this is no longer required. Required — it is the record.',
33
+ required: true,
34
+ }),
35
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
36
+ };
37
+ async run() {
38
+ this.requireAuth();
39
+ const { args, flags } = await this.parse(TasksWaive);
40
+ let result;
41
+ try {
42
+ result = await data_provider_1.dataService.waiveTaskExpectation(args.task, {
43
+ expectationId: args.expectation,
44
+ reason: flags.reason,
45
+ });
46
+ }
47
+ catch (err) {
48
+ this.handleApiError(err);
49
+ return;
50
+ }
51
+ if (flags.json) {
52
+ this.log(JSON.stringify(result, null, 2));
53
+ return;
54
+ }
55
+ this.log(`Waived ${args.expectation}: ${flags.reason}`);
56
+ }
57
+ }
58
+ exports.default = TasksWaive;
@@ -48,5 +48,10 @@ function mergeAgentConfigFlags(body, flags) {
48
48
  }
49
49
  if (flags['recursion-limit'] !== undefined)
50
50
  parsed.recursion_limit = flags['recursion-limit'];
51
+ // Cross-Space Task execution ceiling. `0` means unlimited, matching the
52
+ // Space limits' convention so a user learns one spelling of "no cap".
53
+ if (flags['max-concurrent-task-executions'] !== undefined) {
54
+ parsed.maxConcurrentTaskExecutions = flags['max-concurrent-task-executions'];
55
+ }
51
56
  return (0, prompt_1.mergeDefined)(body, parsed);
52
57
  }
@@ -0,0 +1,15 @@
1
+ import { dataService, type AgentPromptComposition } from '@skrr-ai/data-provider';
2
+ /** Positional and --agent forms agree with the existing `agents tone` UX. */
3
+ export declare function resolveInstructionAgentId(argument?: string, flag?: string): Promise<string>;
4
+ /** Fetch the edit-gated Agent projection used by the web composer. */
5
+ export declare function loadAgentInstructions(agentId: string): Promise<{
6
+ agent: Awaited<ReturnType<typeof dataService.getExpandedAgentById>>;
7
+ composition: AgentPromptComposition;
8
+ }>;
9
+ /**
10
+ * The Agent controller is intentionally the only persistence boundary. It
11
+ * resolves library versions, verifies bindings and materializes legacy
12
+ * `instructions` atomically, so a CLI never tries to compile a prompt itself.
13
+ */
14
+ export declare function saveAgentInstructions(agentId: string, composition: AgentPromptComposition): Promise<import("@skrr-ai/data-provider").Agent>;
15
+ export declare function renderCompositionLines(composition: AgentPromptComposition): string[];
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveInstructionAgentId = resolveInstructionAgentId;
4
+ exports.loadAgentInstructions = loadAgentInstructions;
5
+ exports.saveAgentInstructions = saveAgentInstructions;
6
+ exports.renderCompositionLines = renderCompositionLines;
7
+ const data_provider_1 = require("@skrr-ai/data-provider");
8
+ const agent_resolver_1 = require("./agent-resolver");
9
+ const instruction_blocks_1 = require("./instruction-blocks");
10
+ /** Positional and --agent forms agree with the existing `agents tone` UX. */
11
+ async function resolveInstructionAgentId(argument, flag) {
12
+ return (0, agent_resolver_1.resolveAgentId)((0, agent_resolver_1.mergeExplicitAgentInputs)([
13
+ { label: 'argument', value: argument },
14
+ { label: '--agent', value: flag },
15
+ ]));
16
+ }
17
+ /** Fetch the edit-gated Agent projection used by the web composer. */
18
+ async function loadAgentInstructions(agentId) {
19
+ const agent = await data_provider_1.dataService.getExpandedAgentById({ agent_id: agentId });
20
+ return { agent, composition: (0, instruction_blocks_1.compositionForAgent)(agent) };
21
+ }
22
+ /**
23
+ * The Agent controller is intentionally the only persistence boundary. It
24
+ * resolves library versions, verifies bindings and materializes legacy
25
+ * `instructions` atomically, so a CLI never tries to compile a prompt itself.
26
+ */
27
+ async function saveAgentInstructions(agentId, composition) {
28
+ return data_provider_1.dataService.updateAgent({
29
+ agent_id: agentId,
30
+ data: { promptComposition: composition },
31
+ });
32
+ }
33
+ function renderCompositionLines(composition) {
34
+ if (!composition.entries.length)
35
+ return ['(No custom instruction blocks.)'];
36
+ return composition.entries.flatMap((entry, index) => {
37
+ const state = entry.enabled ? 'on' : 'off';
38
+ if (entry.source.kind === 'inline') {
39
+ const preview = entry.source.body.trim().replace(/\s+/g, ' ').slice(0, 140);
40
+ return [
41
+ `${index + 1}. ${state.padEnd(3)} inline ${entry.source.title} (${entry.instanceId})`,
42
+ ` ${preview || '(empty)'}`,
43
+ ];
44
+ }
45
+ const label = entry.resolved?.name || entry.source.blockId;
46
+ const bindings = entry.bindings && Object.keys(entry.bindings).length
47
+ ? ` · bindings: ${Object.entries(entry.bindings)
48
+ .map(([key, value]) => `${key}=${value}`)
49
+ .join(', ')}`
50
+ : '';
51
+ return [
52
+ `${index + 1}. ${state.padEnd(3)} library ${label} · v${entry.source.version} (${entry.instanceId})${bindings}`,
53
+ ];
54
+ });
55
+ }
@@ -30,5 +30,10 @@ export type CommandHygieneReport = {
30
30
  };
31
31
  export declare function auditCommands({ rootDir, manifest, }: {
32
32
  rootDir: string;
33
- manifest: CommandManifest;
33
+ /**
34
+ * The generated oclif catalogue is not present in a source checkout. Such
35
+ * callers can still run source-level checks, but cannot make claims about
36
+ * what a generated manifest contains.
37
+ */
38
+ manifest?: CommandManifest;
34
39
  }): CommandHygieneReport;
@@ -46,13 +46,14 @@ const AGENT_CRITICAL_COMMANDS = [
46
46
  ];
47
47
  function auditCommands({ rootDir, manifest, }) {
48
48
  const issues = [];
49
- const commands = manifest.commands ?? {};
49
+ const commands = manifest?.commands ?? {};
50
50
  const commandIds = Object.keys(commands);
51
+ const manifestForCatalog = manifest ?? {};
51
52
  // The command manifest is the only catalogue. The progressive `skrr usage`
52
53
  // surfaces are useful precisely because they do not make an agent load that
53
54
  // whole catalogue at once, so audit every generated continuation page too.
54
- const overview = (0, usage_discovery_1.buildUsageOverview)(manifest);
55
- const usageBudgetIssues = (0, usage_discovery_1.auditUsageBudgets)(manifest);
55
+ const overview = (0, usage_discovery_1.buildUsageOverview)(manifestForCatalog);
56
+ const usageBudgetIssues = (0, usage_discovery_1.auditUsageBudgets)(manifestForCatalog);
56
57
  for (const issue of usageBudgetIssues) {
57
58
  issues.push({
58
59
  code: 'USAGE_DISCOVERY_TOKEN_BUDGET_EXCEEDED',
@@ -62,14 +63,31 @@ function auditCommands({ rootDir, manifest, }) {
62
63
  `uses ${issue.estimatedTokens} estimated tokens; budget is ${issue.tokenBudget}.`,
63
64
  });
64
65
  }
65
- for (const id of AGENT_CRITICAL_COMMANDS) {
66
- if (!commands[id]) {
67
- issues.push({
68
- code: 'AGENT_CRITICAL_COMMAND_MISSING',
69
- severity: 'error',
70
- command: id,
71
- message: `Agent-critical command is missing from the manifest: ${id}`,
72
- });
66
+ if (!manifest) {
67
+ // Absence is a distinct answer from "missing", and it should be audible.
68
+ //
69
+ // Skipping silently means a source-only run reports a clean bill of health
70
+ // for a check it never performed. That is the shape that makes an audit
71
+ // untrustworthy — worse than a noisy one, because a green result stops
72
+ // meaning anything. A warning keeps the run green while saying which claim
73
+ // it is NOT making, and names the command that would let it.
74
+ issues.push({
75
+ code: 'AGENT_CRITICAL_COMMANDS_UNCHECKED',
76
+ severity: 'warning',
77
+ message: 'No command manifest was available, so the agent-critical command check did not run. ' +
78
+ 'Build the CLI (`npx tsc -p tsconfig.build.json && npx oclif manifest` in cli/) to audit it.',
79
+ });
80
+ }
81
+ if (manifest) {
82
+ for (const id of AGENT_CRITICAL_COMMANDS) {
83
+ if (!commands[id]) {
84
+ issues.push({
85
+ code: 'AGENT_CRITICAL_COMMAND_MISSING',
86
+ severity: 'error',
87
+ command: id,
88
+ message: `Agent-critical command is missing from the manifest: ${id}`,
89
+ });
90
+ }
73
91
  }
74
92
  }
75
93
  let sourceAvailable = false;
@@ -129,23 +147,25 @@ function auditCommands({ rootDir, manifest, }) {
129
147
  message: 'Source command files are unavailable; source-level hygiene checks were skipped.',
130
148
  });
131
149
  }
132
- for (const id of commandIds) {
133
- const command = commands[id];
134
- if (!command?.description?.trim()) {
135
- issues.push({
136
- code: 'COMMAND_DESCRIPTION_MISSING',
137
- severity: 'warning',
138
- command: id,
139
- message: 'Command is missing a description in the manifest.',
140
- });
141
- }
142
- if (!hasJsonFlag(command?.flags) && isMachineRelevantCommand(id)) {
143
- issues.push({
144
- code: 'JSON_SUCCESS_OUTPUT_MISSING',
145
- severity: 'warning',
146
- command: id,
147
- message: 'Machine-relevant command has no --json success-output flag. Keep human-only commands intentional.',
148
- });
150
+ if (manifest) {
151
+ for (const id of commandIds) {
152
+ const command = commands[id];
153
+ if (!command?.description?.trim()) {
154
+ issues.push({
155
+ code: 'COMMAND_DESCRIPTION_MISSING',
156
+ severity: 'warning',
157
+ command: id,
158
+ message: 'Command is missing a description in the manifest.',
159
+ });
160
+ }
161
+ if (!hasJsonFlag(command?.flags) && isMachineRelevantCommand(id)) {
162
+ issues.push({
163
+ code: 'JSON_SUCCESS_OUTPUT_MISSING',
164
+ severity: 'warning',
165
+ command: id,
166
+ message: 'Machine-relevant command has no --json success-output flag. Keep human-only commands intentional.',
167
+ });
168
+ }
149
169
  }
150
170
  }
151
171
  const errors = issues.filter((issue) => issue.severity === 'error').length;
@@ -167,7 +187,7 @@ function auditCommands({ rootDir, manifest, }) {
167
187
  usage: {
168
188
  overviewTokenBudget: overview.tokenBudget,
169
189
  overviewEstimatedTokens: overview.estimatedTokens,
170
- domains: (0, usage_discovery_1.usageDomains)(manifest).length,
190
+ domains: (0, usage_discovery_1.usageDomains)(manifestForCatalog).length,
171
191
  budgetErrors: usageBudgetIssues.length,
172
192
  },
173
193
  issues,
@@ -16,7 +16,7 @@
16
16
  * Two `kind`s: `achieve` (bounded, deadline-bearing) and `maintain` (perpetual
17
17
  * "hold this state", derived from a Compass invariant — not authored here).
18
18
  */
19
- import { COMMITMENT_WATCHED_SOURCES, COMMITMENT_TEMPLATE_IDS, COMMITMENT_CADENCE_MODES, COMMITMENT_CADENCE_TIME_PATTERN, COMMITMENT_CADENCE_MAX_TIMES } from '@skrr-ai/data-provider';
19
+ import { COMMITMENT_WATCHED_SOURCES, COMMITMENT_TEMPLATE_IDS, COMMITMENT_CADENCE_MODES, COMMITMENT_CADENCE_TIME_PATTERN, COMMITMENT_CADENCE_MAX_TIMES, COMMITMENT_AUTONOMY_MODES, COMMITMENT_EXECUTION_ISOLATION_MODES } from '@skrr-ai/data-provider';
20
20
  import type { CommitmentCheck, CommitmentChecksResponse, Commitment, CommitmentListResponse, CommitmentPlanResponse, CommitmentStatusResponse, CommitmentWorkLink } from '@skrr-ai/data-provider';
21
21
  import { withQuery } from './triggers';
22
22
  export { COMMITMENT_WATCHED_SOURCES, COMMITMENT_TEMPLATE_IDS, COMMITMENT_CADENCE_MODES, COMMITMENT_CADENCE_TIME_PATTERN, COMMITMENT_CADENCE_MAX_TIMES, };
@@ -28,8 +28,20 @@ export type { CommitmentCheck, CommitmentChecksResponse, Commitment, CommitmentL
28
28
  * `_Exhaustive*` guards fail to resolve if a canonical value is missing.
29
29
  */
30
30
  export declare const COMMITMENT_STATUSES: readonly ["draft", "active", "paused", "completed", "cancelled", "archived"];
31
- /** Autonomy ladder — how much the commitment may act without asking. */
32
- export declare const COMMITMENT_AUTONOMY_MODES: readonly ["off", "suggestions_only", "ask_first", "auto_run_limited", "auto_run"];
31
+ /**
32
+ * Autonomy ladder how much the commitment may act without asking.
33
+ *
34
+ * Re-exported, not restated: `@skrr-ai/data-provider` owns the vocabulary, and
35
+ * a second literal here is how the CLI would silently drift from the server
36
+ * that rejects its values.
37
+ */
38
+ export { COMMITMENT_AUTONOMY_MODES };
39
+ /**
40
+ * Where a Commitment's autonomous runs do their work. Re-exported for the same
41
+ * reason as the ladder above: the vocabulary is the server's, and a picker that
42
+ * offers a value the API rejects is a silent drift.
43
+ */
44
+ export { COMMITMENT_EXECUTION_ISOLATION_MODES };
33
45
  /**
34
46
  * Interval bounds for `cadence.intervalMs`.
35
47
  *
@@ -210,6 +222,7 @@ export declare const commitmentApi: {
210
222
  get: (id: string) => Promise<CommitmentStatusResponse>;
211
223
  create: (body: Record<string, unknown>) => Promise<Commitment>;
212
224
  update: (id: string, body: Record<string, unknown>) => Promise<Commitment>;
225
+ draftPreflight: (body: Record<string, unknown>) => Promise<CommitmentPreflightReport>;
213
226
  workLinks: (id: string, includeInactive?: boolean) => Promise<{
214
227
  object: "commitment_work_link_list";
215
228
  data: CommitmentWorkLink[];
@@ -347,6 +360,18 @@ export declare const COMMITMENT_FEEDBACK_KINDS: readonly ["useful", "noisy", "wr
347
360
  export declare const COMMITMENT_REMEDIATION_ACTIONS: readonly ["pause_commitment", "mute_user_nudges", "reduce_nudge_frequency", "tighten_policy", "mark_noop"];
348
361
  /** The only keys `createBodySchema` (a `z.strictObject`) accepts. */
349
362
  export declare const COMMITMENT_CREATE_KEYS: readonly ["agentId", "kind", "compassId", "compassOrigin", "goalId", "title", "description", "agentDirective", "status", "target", "watchedSources", "policy", "cadence", "subject", "sensors", "grants", "reports", "createdVia"];
363
+ /**
364
+ * Read the per-Commitment domain policy from an inline flag or a text file.
365
+ *
366
+ * This deliberately uses a separate pair of names from Agent-level instruction
367
+ * commands: the result configures one Commitment run, not the Agent's global
368
+ * prompt. The explicit error also keeps shell users from accidentally masking
369
+ * a reviewed file with a short inline experiment.
370
+ */
371
+ export declare function readCommitmentAgentDirective({ directive, file, }: {
372
+ directive?: string;
373
+ file?: string;
374
+ }): Promise<string | undefined>;
350
375
  /**
351
376
  * Normalize a `--from-json` body into something the create endpoint accepts.
352
377
  *
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COMMITMENT_CLI_EVALUATORS = exports.COMMITMENT_CREATE_KEYS = exports.COMMITMENT_REMEDIATION_ACTIONS = exports.COMMITMENT_FEEDBACK_KINDS = exports.commitmentApi = exports.commitmentPackApi = exports.MAX_COMMITMENT_INTERVAL_MS = exports.MIN_COMMITMENT_INTERVAL_MS = exports.COMMITMENT_AUTONOMY_MODES = exports.COMMITMENT_STATUSES = exports.COMMITMENT_CADENCE_MAX_TIMES = exports.COMMITMENT_CADENCE_TIME_PATTERN = exports.COMMITMENT_CADENCE_MODES = exports.COMMITMENT_TEMPLATE_IDS = exports.COMMITMENT_WATCHED_SOURCES = void 0;
3
+ exports.COMMITMENT_CLI_EVALUATORS = exports.COMMITMENT_CREATE_KEYS = exports.COMMITMENT_REMEDIATION_ACTIONS = exports.COMMITMENT_FEEDBACK_KINDS = exports.commitmentApi = exports.commitmentPackApi = exports.MAX_COMMITMENT_INTERVAL_MS = exports.MIN_COMMITMENT_INTERVAL_MS = exports.COMMITMENT_EXECUTION_ISOLATION_MODES = exports.COMMITMENT_AUTONOMY_MODES = exports.COMMITMENT_STATUSES = exports.COMMITMENT_CADENCE_MAX_TIMES = exports.COMMITMENT_CADENCE_TIME_PATTERN = exports.COMMITMENT_CADENCE_MODES = exports.COMMITMENT_TEMPLATE_IDS = exports.COMMITMENT_WATCHED_SOURCES = void 0;
4
+ exports.readCommitmentAgentDirective = readCommitmentAgentDirective;
4
5
  exports.normalizeCreateBody = normalizeCreateBody;
5
6
  exports.parseIntervalToMs = parseIntervalToMs;
6
7
  exports.buildWatchedSources = buildWatchedSources;
@@ -45,6 +46,9 @@ Object.defineProperty(exports, "COMMITMENT_TEMPLATE_IDS", { enumerable: true, ge
45
46
  Object.defineProperty(exports, "COMMITMENT_CADENCE_MODES", { enumerable: true, get: function () { return data_provider_1.COMMITMENT_CADENCE_MODES; } });
46
47
  Object.defineProperty(exports, "COMMITMENT_CADENCE_TIME_PATTERN", { enumerable: true, get: function () { return data_provider_1.COMMITMENT_CADENCE_TIME_PATTERN; } });
47
48
  Object.defineProperty(exports, "COMMITMENT_CADENCE_MAX_TIMES", { enumerable: true, get: function () { return data_provider_1.COMMITMENT_CADENCE_MAX_TIMES; } });
49
+ Object.defineProperty(exports, "COMMITMENT_AUTONOMY_MODES", { enumerable: true, get: function () { return data_provider_1.COMMITMENT_AUTONOMY_MODES; } });
50
+ Object.defineProperty(exports, "COMMITMENT_EXECUTION_ISOLATION_MODES", { enumerable: true, get: function () { return data_provider_1.COMMITMENT_EXECUTION_ISOLATION_MODES; } });
51
+ const instruction_input_1 = require("./instruction-input");
48
52
  const format_1 = require("./format");
49
53
  const triggers_1 = require("./triggers");
50
54
  /**
@@ -63,16 +67,6 @@ exports.COMMITMENT_STATUSES = [
63
67
  ];
64
68
  const _statusDriftGuard = true;
65
69
  void _statusDriftGuard;
66
- /** Autonomy ladder — how much the commitment may act without asking. */
67
- exports.COMMITMENT_AUTONOMY_MODES = [
68
- 'off',
69
- 'suggestions_only',
70
- 'ask_first',
71
- 'auto_run_limited',
72
- 'auto_run',
73
- ];
74
- const _autonomyDriftGuard = true;
75
- void _autonomyDriftGuard;
76
70
  /**
77
71
  * Interval bounds for `cadence.intervalMs`.
78
72
  *
@@ -116,6 +110,7 @@ exports.commitmentApi = {
116
110
  get: (id) => data_provider_1.request.get(base(id)),
117
111
  create: (body) => data_provider_1.request.post('/api/commitments', body),
118
112
  update: (id, body) => data_provider_1.request.patch(base(id), body),
113
+ draftPreflight: (body) => data_provider_1.request.post('/api/commitments/preflight', body),
119
114
  workLinks: (id, includeInactive = false) => data_provider_1.request.get((0, triggers_1.withQuery)(`${base(id)}/links`, { ...(includeInactive ? { includeInactive: true } : {}) })),
120
115
  createWorkLink: (id, body) => data_provider_1.request.post(`${base(id)}/links`, body),
121
116
  updateWorkLink: (id, linkId, body) => data_provider_1.request.patch(`${base(id)}/links/${encodeURIComponent(linkId)}`, body),
@@ -238,6 +233,20 @@ exports.COMMITMENT_CREATE_KEYS = [
238
233
  'reports',
239
234
  'createdVia',
240
235
  ];
236
+ /**
237
+ * Read the per-Commitment domain policy from an inline flag or a text file.
238
+ *
239
+ * This deliberately uses a separate pair of names from Agent-level instruction
240
+ * commands: the result configures one Commitment run, not the Agent's global
241
+ * prompt. The explicit error also keeps shell users from accidentally masking
242
+ * a reviewed file with a short inline experiment.
243
+ */
244
+ async function readCommitmentAgentDirective({ directive, file, }) {
245
+ if (directive !== undefined && file !== undefined) {
246
+ throw new Error('Use either --agent-directive or --agent-directive-file, not both.');
247
+ }
248
+ return (0, instruction_input_1.readInstructionBody)({ body: directive, file });
249
+ }
241
250
  /**
242
251
  * Normalize a `--from-json` body into something the create endpoint accepts.
243
252
  *
@@ -72,6 +72,19 @@ export declare function notInstalledMessage(): string;
72
72
  * may depend on.
73
73
  */
74
74
  export declare function execRuntimeBinary(args: string[]): Promise<number>;
75
+ /** Output from a short-lived runtime probe such as `skrrd status --json`. */
76
+ export type RuntimeBinaryOutput = {
77
+ code: number;
78
+ stdout: string;
79
+ stderr: string;
80
+ };
81
+ /**
82
+ * Invoke the installed runtime without inheriting its streams. The regular
83
+ * lifecycle command still owns the terminal; this is only for the wrapper's
84
+ * post-condition probes, where output is evidence rather than user-facing
85
+ * command output.
86
+ */
87
+ export declare function execRuntimeBinaryCapture(args: string[]): Promise<RuntimeBinaryOutput>;
75
88
  /**
76
89
  * Check an installed daemon's top-level help before forwarding a command that
77
90
  * was added after older daemon releases shipped. A false result is useful to
@@ -10,6 +10,7 @@ exports.isCurrentRuntimeBinary = isCurrentRuntimeBinary;
10
10
  exports.normalizeRuntimeGlobalArgs = normalizeRuntimeGlobalArgs;
11
11
  exports.notInstalledMessage = notInstalledMessage;
12
12
  exports.execRuntimeBinary = execRuntimeBinary;
13
+ exports.execRuntimeBinaryCapture = execRuntimeBinaryCapture;
13
14
  exports.runtimeBinarySupportsSubcommand = runtimeBinarySupportsSubcommand;
14
15
  /**
15
16
  * exec-runtime-binary.ts — locate and forward to the local runtime binary.
@@ -242,6 +243,50 @@ function execRuntimeBinary(args) {
242
243
  });
243
244
  });
244
245
  }
246
+ /**
247
+ * Invoke the installed runtime without inheriting its streams. The regular
248
+ * lifecycle command still owns the terminal; this is only for the wrapper's
249
+ * post-condition probes, where output is evidence rather than user-facing
250
+ * command output.
251
+ */
252
+ function execRuntimeBinaryCapture(args) {
253
+ return new Promise((resolve, reject) => {
254
+ const bin = findRuntimeBinary();
255
+ if (!bin) {
256
+ reject(new Error('runtime-binary-not-installed'));
257
+ return;
258
+ }
259
+ const isWinShim = process.platform === 'win32' && /\.(cmd|bat)$/i.test(bin);
260
+ const child = (0, node_child_process_1.spawn)(bin, normalizeRuntimeGlobalArgs(args), {
261
+ stdio: ['ignore', 'pipe', 'pipe'],
262
+ ...(isWinShim ? { shell: true } : {}),
263
+ });
264
+ let stdout = '';
265
+ let stderr = '';
266
+ // A status response is tiny. Keep a broken runtime from making its wrapper
267
+ // retain an unbounded stream merely to decide whether `start` worked.
268
+ const append = (current, chunk) => {
269
+ const limit = 256 * 1024;
270
+ if (current.length >= limit)
271
+ return current;
272
+ return (current + chunk.toString()).slice(0, limit);
273
+ };
274
+ child.stdout?.on('data', (chunk) => {
275
+ stdout = append(stdout, chunk);
276
+ });
277
+ child.stderr?.on('data', (chunk) => {
278
+ stderr = append(stderr, chunk);
279
+ });
280
+ child.on('error', reject);
281
+ child.on('exit', (code, signal) => {
282
+ resolve({
283
+ code: signal ? 128 + signalNumber(signal) : (code ?? 0),
284
+ stdout,
285
+ stderr,
286
+ });
287
+ });
288
+ });
289
+ }
245
290
  /**
246
291
  * Check an installed daemon's top-level help before forwarding a command that
247
292
  * was added after older daemon releases shipped. A false result is useful to
@@ -2,6 +2,42 @@ export type GitTaskBranch = {
2
2
  branch: string;
3
3
  taskRef: string;
4
4
  };
5
+ export type TaskDeliveryReceipt = {
6
+ kind: 'commit';
7
+ state: 'branch_ready' | 'integrated';
8
+ commitShas: string[];
9
+ headSha: string;
10
+ branch?: string;
11
+ integrationBranch?: string;
12
+ mergeCommit?: string;
13
+ } | {
14
+ kind: 'pull_request';
15
+ state: 'pr_open' | 'integrated';
16
+ prUrl: string;
17
+ branch?: string;
18
+ headSha?: string;
19
+ integrationBranch?: string;
20
+ mergeCommit?: string;
21
+ };
22
+ type CommandResult = {
23
+ status: number | null;
24
+ stdout: string;
25
+ stderr: string;
26
+ };
27
+ type CommandRunner = (command: string, args: string[], cwd: string) => CommandResult;
28
+ export declare function commitArtifacts(deliverables: string): string[];
29
+ /**
30
+ * Build a receipt for commit/PR deliverables before `tasks complete` writes
31
+ * anything. Commit reachability is checked against a freshly fetched remote
32
+ * default branch. A locally dangling commit is first anchored under refs/heads
33
+ * so even a held completion cannot leave it exposed to `git gc`.
34
+ */
35
+ export declare function inspectTaskDeliveryArtifacts(opts: {
36
+ deliverables: string;
37
+ taskRef: string;
38
+ cwd?: string;
39
+ runner?: CommandRunner;
40
+ }): TaskDeliveryReceipt | null;
5
41
  export declare class GitTaskError extends Error {
6
42
  readonly code: 'GIT_REPOSITORY_REQUIRED' | 'TASK_BRANCH_CONTEXT_MISSING' | 'GIT_BRANCH_SWITCH_FAILED';
7
43
  constructor(message: string, code: 'GIT_REPOSITORY_REQUIRED' | 'TASK_BRANCH_CONTEXT_MISSING' | 'GIT_BRANCH_SWITCH_FAILED');
@@ -23,3 +59,4 @@ export declare function checkoutTaskBranch(taskRef: string, cwd?: string): {
23
59
  branch: string;
24
60
  created: boolean;
25
61
  };
62
+ export {};