@claudexor/control-api 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/authorization.d.ts +3 -0
  2. package/dist/authorization.d.ts.map +1 -0
  3. package/dist/authorization.js +15 -0
  4. package/dist/authorization.js.map +1 -0
  5. package/dist/binary-response.d.ts +5 -0
  6. package/dist/binary-response.d.ts.map +1 -0
  7. package/dist/binary-response.js +31 -0
  8. package/dist/binary-response.js.map +1 -0
  9. package/dist/budget-valuation.d.ts +23 -0
  10. package/dist/budget-valuation.d.ts.map +1 -0
  11. package/dist/budget-valuation.js +90 -0
  12. package/dist/budget-valuation.js.map +1 -0
  13. package/dist/catalog-query.d.ts +310 -0
  14. package/dist/catalog-query.d.ts.map +1 -0
  15. package/dist/catalog-query.js +36 -0
  16. package/dist/catalog-query.js.map +1 -0
  17. package/dist/daemon-server.d.ts +33 -79
  18. package/dist/daemon-server.d.ts.map +1 -1
  19. package/dist/daemon-server.js +175 -281
  20. package/dist/daemon-server.js.map +1 -1
  21. package/dist/decision-accept-risk.d.ts +36 -0
  22. package/dist/decision-accept-risk.d.ts.map +1 -0
  23. package/dist/decision-accept-risk.js +79 -0
  24. package/dist/decision-accept-risk.js.map +1 -0
  25. package/dist/decision-rerun.d.ts +2 -1
  26. package/dist/decision-rerun.d.ts.map +1 -1
  27. package/dist/decision-rerun.js +79 -48
  28. package/dist/decision-rerun.js.map +1 -1
  29. package/dist/delegation-control.d.ts +23 -0
  30. package/dist/delegation-control.d.ts.map +1 -0
  31. package/dist/delegation-control.js +81 -0
  32. package/dist/delegation-control.js.map +1 -0
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/maintenance-routes.d.ts +2 -2
  38. package/dist/maintenance-routes.d.ts.map +1 -1
  39. package/dist/maintenance-routes.js +11 -10
  40. package/dist/maintenance-routes.js.map +1 -1
  41. package/dist/operation-catalog.d.ts +9 -9
  42. package/dist/operation-catalog.d.ts.map +1 -1
  43. package/dist/operation-catalog.js +22 -79
  44. package/dist/operation-catalog.js.map +1 -1
  45. package/dist/operation-draft.d.ts +3 -0
  46. package/dist/operation-draft.d.ts.map +1 -0
  47. package/dist/operation-draft.js +2 -0
  48. package/dist/operation-draft.js.map +1 -0
  49. package/dist/operation-parameters.d.ts.map +1 -1
  50. package/dist/operation-summaries.d.ts +3 -0
  51. package/dist/operation-summaries.d.ts.map +1 -0
  52. package/dist/operation-summaries.js +75 -0
  53. package/dist/operation-summaries.js.map +1 -0
  54. package/dist/primary-output.d.ts +3 -3
  55. package/dist/primary-output.d.ts.map +1 -1
  56. package/dist/primary-output.js +70 -19
  57. package/dist/primary-output.js.map +1 -1
  58. package/dist/problem-response.d.ts.map +1 -1
  59. package/dist/problem-response.js +14 -9
  60. package/dist/problem-response.js.map +1 -1
  61. package/dist/project-routes.d.ts +21 -13
  62. package/dist/project-routes.d.ts.map +1 -1
  63. package/dist/project-routes.js +80 -34
  64. package/dist/project-routes.js.map +1 -1
  65. package/dist/remote-operation-descriptors.d.ts +36 -0
  66. package/dist/remote-operation-descriptors.d.ts.map +1 -0
  67. package/dist/remote-operation-descriptors.js +35 -0
  68. package/dist/remote-operation-descriptors.js.map +1 -0
  69. package/dist/resource-routes.d.ts +4 -3
  70. package/dist/resource-routes.d.ts.map +1 -1
  71. package/dist/resource-routes.js +63 -39
  72. package/dist/resource-routes.js.map +1 -1
  73. package/dist/route-stages.d.ts +15 -0
  74. package/dist/route-stages.d.ts.map +1 -0
  75. package/dist/route-stages.js +24 -0
  76. package/dist/route-stages.js.map +1 -0
  77. package/dist/run-facts-projection.d.ts +35 -0
  78. package/dist/run-facts-projection.d.ts.map +1 -0
  79. package/dist/run-facts-projection.js +133 -0
  80. package/dist/run-facts-projection.js.map +1 -0
  81. package/dist/run-list-fingerprint.d.ts +7 -0
  82. package/dist/run-list-fingerprint.d.ts.map +1 -0
  83. package/dist/run-list-fingerprint.js +68 -0
  84. package/dist/run-list-fingerprint.js.map +1 -0
  85. package/dist/run-record.d.ts +53 -0
  86. package/dist/run-record.d.ts.map +1 -0
  87. package/dist/run-record.js +61 -0
  88. package/dist/run-record.js.map +1 -0
  89. package/dist/run-retry-routes.d.ts +3 -2
  90. package/dist/run-retry-routes.d.ts.map +1 -1
  91. package/dist/run-retry-routes.js +129 -48
  92. package/dist/run-retry-routes.js.map +1 -1
  93. package/dist/run-start.d.ts +13 -1
  94. package/dist/run-start.d.ts.map +1 -1
  95. package/dist/run-start.js +90 -18
  96. package/dist/run-start.js.map +1 -1
  97. package/dist/run-timeline.d.ts.map +1 -1
  98. package/dist/run-timeline.js +17 -9
  99. package/dist/run-timeline.js.map +1 -1
  100. package/dist/thread-lifecycle-routes.d.ts +1 -1
  101. package/dist/thread-lifecycle-routes.d.ts.map +1 -1
  102. package/dist/thread-lifecycle-routes.js +3 -4
  103. package/dist/thread-lifecycle-routes.js.map +1 -1
  104. package/dist/thread-mutation.d.ts +6 -0
  105. package/dist/thread-mutation.d.ts.map +1 -1
  106. package/dist/thread-mutation.js +23 -0
  107. package/dist/thread-mutation.js.map +1 -1
  108. package/dist/thread-projection.d.ts +6 -1
  109. package/dist/thread-projection.d.ts.map +1 -1
  110. package/dist/thread-projection.js +28 -1
  111. package/dist/thread-projection.js.map +1 -1
  112. package/dist/thread-recovery.d.ts +54 -0
  113. package/dist/thread-recovery.d.ts.map +1 -0
  114. package/dist/thread-recovery.js +71 -0
  115. package/dist/thread-recovery.js.map +1 -0
  116. package/dist/thread-turn-routes.d.ts +22 -8
  117. package/dist/thread-turn-routes.d.ts.map +1 -1
  118. package/dist/thread-turn-routes.js +73 -49
  119. package/dist/thread-turn-routes.js.map +1 -1
  120. package/package.json +6 -6
@@ -1,12 +1,21 @@
1
1
  import { ControlRunDecisionResponse, ControlRunStartRequest, } from "@claudexor/schema";
2
- import { recordTurnEnqueueFailure } from "./thread-turn-routes.js";
2
+ import { recordTurnEnqueueFailure, turnEnqueueProblemResponse } from "./thread-turn-routes.js";
3
+ import { resolveThreadRecoveryTurn } from "./thread-recovery.js";
4
+ import { TERMINAL_STATES } from "./sse-shared.js";
3
5
  import * as runStart from "./run-start.js";
4
6
  export async function rerunWithFeedback(ctx, rec, body, idempotencyKey, res) {
5
7
  if (!body.feedback?.trim())
6
8
  return ctx.json(res, 400, { error: "feedback is required" });
7
9
  const source = paramsRecord(rec);
10
+ if (typeof source["delegatedFromRunId"] === "string") {
11
+ return ctx.json(res, 409, {
12
+ error: "Decision rerun is unavailable for a Delegate child after its parent authority ends; use Run Again to create an ordinary editable run",
13
+ code: "delegated_child_rerun_unavailable",
14
+ retryable: false,
15
+ });
16
+ }
8
17
  const originalPrompt = typeof source["prompt"] === "string" ? source["prompt"] : "";
9
- const { turnId: _turnId, planRunId: _planRunId, planRef: _planRef, ...original } = source;
18
+ const { turnId: _turnId, planRunId: _planRunId, planRef: _planRef, retryOf: _retryOf, protectedPathApprovals: _protectedPathApprovals, ...original } = source;
10
19
  let params;
11
20
  try {
12
21
  params = runStart.normalizeRunStart(ControlRunStartRequest.parse({
@@ -21,56 +30,78 @@ export async function rerunWithFeedback(ctx, rec, body, idempotencyKey, res) {
21
30
  });
22
31
  }
23
32
  const threadId = typeof source["threadId"] === "string" ? source["threadId"] : null;
24
- let turnId;
25
- if (threadId && ctx.services?.createThreadTurn) {
26
- const turn = (await ctx.services.createThreadTurn(threadId, params.prompt, {
27
- kind: "decision",
28
- parentRunId: rec.runId ?? rec.id,
29
- idempotency: {
33
+ const rerun = async () => {
34
+ let turnId;
35
+ if (threadId) {
36
+ const idempotency = {
30
37
  key: idempotencyKey,
31
38
  client: "control-api",
32
39
  request: { runId: rec.runId ?? rec.id, body },
33
- },
40
+ };
41
+ const turn = await resolveThreadRecoveryTurn(ctx.daemon, ctx.services, rec, threadId, params.prompt, { kind: "decision", parentRunId: rec.runId ?? rec.id }, idempotency, (existingTurnId) => ctx.daemon.findAccepted?.({ ...params, turnId: existingTurnId }, {
42
+ idempotencyKey,
43
+ clientId: "control-api",
44
+ operation: "run.decision.rerun",
45
+ idempotencyRequest: idempotency.request,
46
+ }) ?? Promise.resolve(null));
47
+ turnId = turn.id;
48
+ }
49
+ let job;
50
+ try {
51
+ job = await ctx.daemon.enqueue({ ...params, ...(turnId ? { turnId } : {}) }, {
52
+ idempotencyKey,
53
+ clientId: "control-api",
54
+ operation: "run.decision.rerun",
55
+ idempotencyRequest: { runId: rec.runId ?? rec.id, body },
56
+ });
57
+ }
58
+ catch (error) {
59
+ const problem = recordTurnEnqueueFailure(ctx.services?.setTurnEnqueueError, turnId, error);
60
+ const status = error && typeof error === "object" && "status" in error
61
+ ? Number(error.status)
62
+ : 500;
63
+ return ctx.json(res, status, turnEnqueueProblemResponse(problem, {
64
+ ...(threadId ? { threadId } : {}),
65
+ ...(turnId ? { turnId } : {}),
66
+ }));
67
+ }
68
+ let run;
69
+ try {
70
+ run = await ctx.waitForRunStart(job.id);
71
+ }
72
+ catch (error) {
73
+ return ctx.json(res, 500, {
74
+ error: `rerun job ${job.id} was accepted but its start could not be observed: ${error instanceof Error ? error.message : String(error)}`,
75
+ jobId: job.id,
76
+ ...(turnId ? { turnId } : {}),
77
+ });
78
+ }
79
+ if (!run.runId && TERMINAL_STATES.has(run.state)) {
80
+ const refusal = runStart.unboundRunStartResponse(run, true, {
81
+ ...(threadId ? { threadId } : {}),
82
+ ...(turnId ? { turnId } : {}),
83
+ });
84
+ return ctx.json(res, refusal.status, refusal.body);
85
+ }
86
+ // The daemon command journal is the idempotency authority. Only the
87
+ // request that durably accepted the command owns this audit side effect;
88
+ // same-key replays return the same run without duplicating history.
89
+ if (job.reused === false) {
90
+ ctx.appendAudit(rec, {
91
+ decision: body.action,
92
+ ...(run.runId ? { new_run_id: run.runId } : { new_job_id: run.id }),
93
+ });
94
+ }
95
+ ctx.json(res, 200, ControlRunDecisionResponse.parse({
96
+ accepted: true,
97
+ status: "requeued",
98
+ ...(run.runId ? { newRunId: run.runId } : {}),
99
+ message: run.runId
100
+ ? "follow-up run enqueued with reviewer feedback"
101
+ : "follow-up job enqueued; run start is still pending",
34
102
  }));
35
- turnId = turn.id;
36
- }
37
- let job;
38
- try {
39
- job = await ctx.daemon.enqueue({ ...params, ...(turnId ? { turnId } : {}) }, {
40
- idempotencyKey,
41
- clientId: "control-api",
42
- operation: "run.decision.rerun",
43
- idempotencyRequest: { runId: rec.runId ?? rec.id, body },
44
- });
45
- }
46
- catch (error) {
47
- recordTurnEnqueueFailure(ctx.services?.setTurnEnqueueError, turnId, error);
48
- const status = error && typeof error === "object" && "status" in error
49
- ? Number(error.status)
50
- : 500;
51
- return ctx.json(res, status, {
52
- error: error instanceof Error ? error.message : "rerun enqueue failed",
53
- ...(turnId ? { turnId, retryable: false } : {}),
54
- });
55
- }
56
- let run;
57
- try {
58
- run = await ctx.waitForRunStart(job.id);
59
- }
60
- catch (error) {
61
- return ctx.json(res, 500, {
62
- error: `rerun job ${job.id} was accepted but its start could not be observed: ${error instanceof Error ? error.message : String(error)}`,
63
- jobId: job.id,
64
- ...(turnId ? { turnId } : {}),
65
- });
66
- }
67
- ctx.appendAudit(rec, { decision: body.action, new_run_id: run.runId ?? run.id });
68
- ctx.json(res, 200, ControlRunDecisionResponse.parse({
69
- accepted: true,
70
- status: "requeued",
71
- newRunId: run.runId ?? run.id,
72
- message: "follow-up run enqueued with reviewer feedback",
73
- }));
103
+ };
104
+ return threadId ? ctx.serializeThreadMutation(threadId, rerun) : rerun();
74
105
  }
75
106
  function paramsRecord(rec) {
76
107
  return rec.params && typeof rec.params === "object" && !Array.isArray(rec.params)
@@ -1 +1 @@
1
- {"version":3,"file":"decision-rerun.js","sourceRoot":"","sources":["../src/decision-rerun.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GAEvB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAy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,OAAO,GAAG,CAAC,MAAM,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;QAC/E,CAAC,CAAE,GAAG,CAAC,MAAkC;QACzC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
@@ -0,0 +1,23 @@
1
+ export interface DelegationControlRecord {
2
+ id: string;
3
+ runId?: string;
4
+ state: string;
5
+ }
6
+ export interface DelegationControlDaemon {
7
+ status(id: string): Promise<DelegationControlRecord>;
8
+ cancel(id: string): Promise<unknown>;
9
+ fenceDelegationParent?(runId: string): Promise<unknown>;
10
+ }
11
+ /** Fence admission, cancel the whole family, and wait for child settlement.
12
+ * Every cancel is attempted even after another fails; the collected failure is
13
+ * reported only after the parent has also been signalled. */
14
+ export declare function cancelDelegationFamily(input: {
15
+ daemon: DelegationControlDaemon;
16
+ parent: DelegationControlRecord;
17
+ descendantsAfterFence: () => Promise<DelegationControlRecord[]>;
18
+ timeoutMs?: number;
19
+ pollMs?: number;
20
+ }): Promise<{
21
+ descendants: DelegationControlRecord[];
22
+ }>;
23
+ //# sourceMappingURL=delegation-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegation-control.d.ts","sourceRoot":"","sources":["../src/delegation-control.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACrD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,qBAAqB,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzD;AAID;;6DAE6D;AAC7D,wBAAsB,sBAAsB,CAAC,KAAK,EAAE;IAClD,MAAM,EAAE,uBAAuB,CAAC;IAChC,MAAM,EAAE,uBAAuB,CAAC;IAChC,qBAAqB,EAAE,MAAM,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,uBAAuB,EAAE,CAAA;CAAE,CAAC,CA+EtD"}
@@ -0,0 +1,81 @@
1
+ const terminal = (state) => state !== "queued" && state !== "running";
2
+ /** Fence admission, cancel the whole family, and wait for child settlement.
3
+ * Every cancel is attempted even after another fails; the collected failure is
4
+ * reported only after the parent has also been signalled. */
5
+ export async function cancelDelegationFamily(input) {
6
+ const parentRunId = input.parent.runId ?? input.parent.id;
7
+ const failures = [];
8
+ let parentSignalled = false;
9
+ try {
10
+ if (!input.daemon.fenceDelegationParent)
11
+ throw new Error("daemon does not expose a fence");
12
+ await input.daemon.fenceDelegationParent(parentRunId);
13
+ }
14
+ catch (error) {
15
+ const fenceFailure = `fence: ${error instanceof Error ? error.message : String(error)}`;
16
+ // Without a confirmed fence, abort the parent BEFORE taking the child
17
+ // snapshot. Daemon cancellation fences its live run authority atomically,
18
+ // so no new child can enter the family between snapshot and cascade.
19
+ try {
20
+ await input.daemon.cancel(input.parent.id);
21
+ parentSignalled = true;
22
+ }
23
+ catch (cancelError) {
24
+ failures.push(fenceFailure);
25
+ failures.push(`parent ${parentRunId}: ${cancelError instanceof Error ? cancelError.message : String(cancelError)}`);
26
+ }
27
+ }
28
+ let descendants = [];
29
+ try {
30
+ descendants = await input.descendantsAfterFence();
31
+ }
32
+ catch (error) {
33
+ failures.push(`descendant snapshot: ${error instanceof Error ? error.message : String(error)}`);
34
+ }
35
+ const active = descendants.filter((record) => !terminal(record.state)).reverse();
36
+ for (const child of active) {
37
+ try {
38
+ await input.daemon.cancel(child.id);
39
+ }
40
+ catch (error) {
41
+ failures.push(`child ${child.runId ?? child.id}: ${error instanceof Error ? error.message : String(error)}`);
42
+ }
43
+ }
44
+ if (!parentSignalled) {
45
+ try {
46
+ await input.daemon.cancel(input.parent.id);
47
+ parentSignalled = true;
48
+ }
49
+ catch (error) {
50
+ failures.push(`parent ${parentRunId}: ${error instanceof Error ? error.message : String(error)}`);
51
+ }
52
+ }
53
+ const deadline = Date.now() + (input.timeoutMs ?? 10_000);
54
+ const pollMs = input.pollMs ?? 25;
55
+ for (const child of active) {
56
+ for (;;) {
57
+ try {
58
+ const current = await input.daemon.status(child.id);
59
+ if (terminal(current.state))
60
+ break;
61
+ }
62
+ catch (error) {
63
+ failures.push(`child ${child.runId ?? child.id} status: ${error instanceof Error ? error.message : String(error)}`);
64
+ break;
65
+ }
66
+ if (Date.now() >= deadline) {
67
+ failures.push(`child ${child.runId ?? child.id}: terminal drain timed out`);
68
+ break;
69
+ }
70
+ await new Promise((resolve) => setTimeout(resolve, pollMs));
71
+ }
72
+ }
73
+ if (failures.length > 0) {
74
+ throw Object.assign(new Error(`delegation family cancellation incomplete: ${failures.join("; ")}`), {
75
+ code: "delegation_cancel_incomplete",
76
+ status: 503,
77
+ });
78
+ }
79
+ return { descendants: active.reverse() };
80
+ }
81
+ //# sourceMappingURL=delegation-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegation-control.js","sourceRoot":"","sources":["../src/delegation-control.ts"],"names":[],"mappings":"AAYA,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,CAAC;AAEvF;;6DAE6D;AAC7D,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,KAM5C;IACC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,eAAe,GAA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ACpD,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;oBAAE,MAAM;YACrC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,QAAQ,CAAC,IAAI,CACX,SAAS,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,YAAY,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACrG,CAAC;gBACF,MAAM;YACR,CAAC;YACD,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;gBAC3B,QAAQ,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,EAAE,4BAA4B,CAAC,CAAC;gBAC5E,MAAM;YACR,CAAC;YACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,MAAM,CAAC,MAAM,CACjB,IAAI,KAAK,CAAC,8CAA8C,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAC9E;YACE,IAAI,EAAE,8BAA8B;YACpC,MAAM,EAAE,GAAG;SACZ,CACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;AAC3C,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./daemon-server.js";
2
2
  export * from "./operation-catalog.js";
3
3
  export * from "./retention.js";
4
+ export { normalizeExistingProjectRoot } from "./run-start.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./daemon-server.js";
2
2
  export * from "./operation-catalog.js";
3
3
  export * from "./retention.js";
4
+ export { normalizeExistingProjectRoot } from "./run-start.js";
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { IncomingMessage, ServerResponse } from "node:http";
2
- import { ControlGcRequest, type ControlGcReceipt } from "@claudexor/schema";
2
+ import { ControlGcReceipt, ControlGcRequest } from "@claudexor/schema";
3
3
  export interface MaintenanceRouteServices {
4
4
  /** One retention pass over engine-owned runtime artifacts (W3.6). */
5
5
  runRetention(request: ControlGcRequest): Promise<ControlGcReceipt>;
@@ -8,7 +8,7 @@ export interface MaintenanceRouteContext {
8
8
  services?: Partial<MaintenanceRouteServices>;
9
9
  readBody(req: IncomingMessage): Promise<unknown>;
10
10
  json(res: ServerResponse, status: number, body: unknown): void;
11
- requestError(res: ServerResponse, error: unknown): void;
11
+ requestError(res: ServerResponse, error: unknown, fallbackStatus?: 400 | 500): void;
12
12
  }
13
13
  export declare function handleMaintenanceRoute(ctx: MaintenanceRouteContext, method: string, path: string, req: IncomingMessage, res: ServerResponse): Promise<boolean>;
14
14
  //# sourceMappingURL=maintenance-routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"maintenance-routes.d.ts","sourceRoot":"","sources":["../src/maintenance-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC7C,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/D,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACzD;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,uBAAuB,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,OAAO,CAAC,CAYlB"}
1
+ {"version":3,"file":"maintenance-routes.d.ts","sourceRoot":"","sources":["../src/maintenance-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGvE,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC7C,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/D,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;CACrF;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,uBAAuB,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,OAAO,CAAC,CAelB"}
@@ -1,16 +1,17 @@
1
- import { ControlGcRequest } from "@claudexor/schema";
1
+ import { ControlGcReceipt, ControlGcRequest } from "@claudexor/schema";
2
+ import { routeValue, serviceResponse } from "./route-stages.js";
2
3
  export async function handleMaintenanceRoute(ctx, method, path, req, res) {
3
4
  if (method === "POST" && path === "/maintenance/gc") {
4
- if (!ctx.services?.runRetention)
5
+ const service = ctx.services?.runRetention;
6
+ if (!service)
5
7
  return false;
6
- try {
7
- const request = ControlGcRequest.parse((await ctx.readBody(req)) ?? {});
8
- ctx.json(res, 200, await ctx.services.runRetention(request));
9
- }
10
- catch (error) {
11
- ctx.requestError(res, error);
12
- }
13
- return true;
8
+ const request = await routeValue(ctx, res, 400, async () => ControlGcRequest.parse((await ctx.readBody(req)) ?? {}));
9
+ if (!request.ok)
10
+ return true;
11
+ const receipt = await routeValue(ctx, res, 500, () => service(request.value));
12
+ if (!receipt.ok)
13
+ return true;
14
+ return serviceResponse(ctx, res, "runRetention", () => ctx.json(res, 200, ControlGcReceipt.parse(receipt.value)));
14
15
  }
15
16
  return false;
16
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"maintenance-routes.js","sourceRoot":"","sources":["../src/maintenance-routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,mBAAmB,CAAC;AAc5E,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,GAA4B,EAC5B,MAAc,EACd,IAAY,EACZ,GAAoB,EACpB,GAAmB;IAEnB,IAAI,MAAM,KAAK,MAAM,IAAI,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY;YAAE,OAAO,KAAK,CAAC;QAC9C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACxE,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"maintenance-routes.js","sourceRoot":"","sources":["../src/maintenance-routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAchE,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,GAA4B,EAC5B,MAAc,EACd,IAAY,EACZ,GAAoB,EACpB,GAAmB;IAEnB,IAAI,MAAM,KAAK,MAAM,IAAI,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACpD,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC;QAC3C,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAC3B,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,CACzD,gBAAgB,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CACxD,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,OAAO,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QAC7B,OAAO,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,CACpD,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAC1D,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -17,28 +17,28 @@ export declare function resolveControlProtocol(input: {
17
17
  export declare const OPERATION_CATALOG: {
18
18
  protocolMajor: 3;
19
19
  operations: {
20
+ id: string;
21
+ method: "DELETE" | "GET" | "PATCH" | "POST" | "PUT";
20
22
  path: string;
21
23
  summary: string;
22
- id: string;
23
24
  auth: "loopback_bearer" | "loopback_only";
24
- mutability: "read_only" | "mutating";
25
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
26
25
  requestSchema: string | null;
27
26
  parameters: {
28
27
  name: string;
29
- description: string;
30
- required: boolean;
31
28
  location: "header" | "query";
29
+ required: boolean;
32
30
  repeatable: boolean;
33
31
  enum: string[] | null;
34
32
  schemaRef: string | null;
33
+ description: string;
35
34
  }[];
36
35
  responseSchema: string | null;
37
36
  errorSchema: "ControlProblem";
38
- idempotency: "none" | "natural" | "key_required";
39
- applicability: "project" | "run" | "thread" | "global";
40
- responseKind: "stream" | "binary" | "json";
41
- completion: "immediate" | "durable_handle" | "terminal_stream";
37
+ mutability: "mutating" | "read_only";
38
+ idempotency: "key_required" | "natural" | "none";
39
+ applicability: "global" | "project" | "run" | "thread";
40
+ responseKind: "binary" | "json" | "stream";
41
+ completion: "durable_handle" | "immediate" | "terminal_stream";
42
42
  }[];
43
43
  };
44
44
  //# sourceMappingURL=operation-catalog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"operation-catalog.d.ts","sourceRoot":"","sources":["../src/operation-catalog.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAY7E,+FAA+F;AAC/F,wBAAsB,sBAAsB,CAAC,KAAK,EAAE;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9C,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA2EnC;AAmgBD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;CAG5B,CAAC"}
1
+ {"version":3,"file":"operation-catalog.d.ts","sourceRoot":"","sources":["../src/operation-catalog.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAY7E,+FAA+F;AAC/F,wBAAsB,sBAAsB,CAAC,KAAK,EAAE;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9C,QAAQ,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA2EnC;AA8aD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;CAG5B,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import { CONTROL_PROTOCOL_MAJOR, ControlHandshakeRequest, ControlHandshakeResponse, ControlOperationCatalog, ControlProblem, ControlRunState, } from "@claudexor/schema";
2
2
  import { engineBuildIdentity } from "@claudexor/util";
3
3
  import { pathnameDecodes, queryParam, resumeHeader } from "./operation-parameters.js";
4
+ import { REMOTE_OPERATION_DRAFTS } from "./remote-operation-descriptors.js";
5
+ import { OPERATION_SUMMARIES } from "./operation-summaries.js";
4
6
  const protocolProblem = (code, message, requiredActions = []) => ControlProblem.parse({
5
7
  code,
6
8
  message,
@@ -110,84 +112,6 @@ function descriptor(input) {
110
112
  completion: input.completion ?? (input.responseKind === "stream" ? "terminal_stream" : "immediate"),
111
113
  };
112
114
  }
113
- /**
114
- * Human one-line summaries, keyed by `${method} ${path}`, co-located with the
115
- * descriptors they annotate. This IS the descriptor summary data (not a shadow
116
- * of another table) — descriptor() throws if a route has no entry, so the map
117
- * can never silently drift from the operations array.
118
- */
119
- const OPERATION_SUMMARIES = {
120
- "POST /v2/uploads": "Create a single-request streaming upload session for an attachment of the declared size.",
121
- "PUT /v2/uploads/:id/bytes": "Stream the complete declared byte body in ONE request. The store is single-shot: a short, oversized, or interrupted PUT cancels the upload and discards partial bytes — retry by creating a new upload and resending from byte zero. Not resumable.",
122
- "GET /v2/uploads/:id": "Read an upload session's status and received byte count (diagnostic on a cancelled upload, not a resumable offset).",
123
- "DELETE /v2/uploads/:id": "Abort and discard an in-progress upload session.",
124
- "POST /v2/uploads/:id/finalize": "Finalize an upload into a durable attachment resource.",
125
- "POST /v2/handshake": "Negotiate the control protocol major before product calls.",
126
- "GET /v2/operations": "List the implemented operations (this catalog).",
127
- "POST /v2/maintenance/gc": "Run retention garbage collection over expired run trees.",
128
- "GET /v2/agent-capabilities": "List the agent capability catalog this engine advertises.",
129
- "GET /v2/global/events": "Subscribe to the global cross-project event stream (SSE).",
130
- "GET /v2/quota": "Read cached per-profile harness quota snapshots.",
131
- "POST /v2/quota": "Refresh and read per-profile harness quota snapshots.",
132
- "GET /v2/credential-profiles": "List credential profiles per harness.",
133
- "POST /v2/credential-profiles": "Create a credential profile for a harness.",
134
- "PATCH /v2/credential-profiles/:harness/:profileId": "Toggle a credential profile's enabled state (the accounts Enabled row).",
135
- "DELETE /v2/credential-profiles/:harness/:profileId": "Delete a harness credential profile.",
136
- "GET /v2/harnesses": "List installed harnesses and their availability.",
137
- "GET /v2/projects": "List registered projects (durable handles).",
138
- "POST /v2/projects": "Register a project root as a durable handle.",
139
- "POST /v2/projects/:id/relink": "Relink a registered project to a new root.",
140
- "DELETE /v2/projects/:id": "Remove a registered project: retire the registry entry and archive its journal partition. Refused (409) while any non-purged thread or live/queued run references it; run artifacts are left to normal GC.",
141
- "GET /v2/projects/:id/events": "Subscribe to a project's event stream (SSE).",
142
- "GET /v2/projects/:id/outputs": "List a project's durable outputs (artifacts/).",
143
- "GET /v2/projects/:id/outputs/<path>": "Fetch one durable output file from a project.",
144
- "GET /v2/harnesses/:id/models": "List a harness's selectable models.",
145
- "POST /v2/harnesses/:id/auth-readiness": "Re-check a harness's auth readiness (dry).",
146
- "GET /v2/runs": "List a bounded, newest-first, keyset-paginated page of durable run summaries visible to the daemon.",
147
- "POST /v2/runs": "Start a run and return its durable handle.",
148
- "GET /v2/runs/:id": "Read a run's full detail snapshot.",
149
- "POST /v2/runs/:id/retry": "Retry a run, returning a new durable handle.",
150
- "GET /v2/runs/:id/run-again": "Draft a run-again request from a prior run.",
151
- "POST /v2/runs/:id/apply": "Apply a run's work product to the live tree; replay of an already-delivered run is a typed idempotent no-op.",
152
- "POST /v2/runs/:id/apply/check": "Dry-check whether a run's patch would apply; an already-delivered run reports the safe already-applied no-op.",
153
- "GET /v2/runs/:id/artifacts": "List a run tree's technical artifacts.",
154
- "GET /v2/runs/:id/artifacts/<path>": "Fetch one artifact file from a run tree.",
155
- "POST /v2/runs/:id/control": "Send a control signal (cancel/pause) to a run.",
156
- "POST /v2/runs/:id/decision": "Record an operator unblock/rerun decision on a run.",
157
- "GET /v2/runs/:id/events": "Replay + tail a run's event stream (SSE).",
158
- "POST /v2/runs/:id/interactions/:id/answer": "Answer a run's pending interactive question.",
159
- "GET /v2/runs/:id/produced": "List a run's produced project outputs.",
160
- "GET /v2/runs/:id/produced/<path>": "Fetch one produced project-output file from a run.",
161
- "GET /v2/threads": "List conversation threads.",
162
- "POST /v2/threads": "Create a conversation thread.",
163
- "GET /v2/threads/:id": "Read a thread's detail (turns + head).",
164
- "PATCH /v2/threads/:id": "Update a thread's sticky settings (harness/profile/access).",
165
- "POST /v2/threads/:id/trash": "Move a thread to trash.",
166
- "POST /v2/threads/:id/restore": "Restore a thread from trash.",
167
- "POST /v2/threads/:id/purge": "Permanently purge a trashed thread.",
168
- "POST /v2/threads/:id/apply": "Apply the thread's latest run work product.",
169
- "POST /v2/threads/:id/turns": "Enqueue a new turn on a thread.",
170
- "POST /v2/threads/:id/turns/:id/retry": "Retry a thread turn.",
171
- "GET /v2/trust": "List protected-path trust state.",
172
- "POST /v2/trust": "Update protected-path trust state.",
173
- "GET /v2/settings": "Read the settings snapshot.",
174
- "POST /v2/settings": "Update settings.",
175
- "GET /v2/secrets": "List stored secret handles (values never returned).",
176
- "POST /v2/secrets": "Set a stored secret value.",
177
- "DELETE /v2/secrets/:id": "Delete a stored secret.",
178
- "GET /v2/setup/jobs": "List harness setup/login jobs.",
179
- "POST /v2/setup/jobs": "Start a harness setup/login job.",
180
- "GET /v2/setup/jobs/:id": "Read a setup job's status.",
181
- "GET /v2/setup/jobs/:id/snapshot": "Read a setup job's terminal snapshot.",
182
- "GET /v2/setup/jobs/:id/events": "Tail a setup job's event stream (SSE).",
183
- "POST /v2/setup/jobs/:id/cancel": "Cancel a setup job.",
184
- "POST /v2/setup/jobs/:id/reconcile": "Reconcile a setup job's state.",
185
- "POST /v2/setup/jobs/:id/extend": "Extend a setup job's deadline.",
186
- "GET /v2/recovery/partitions/:id": "Inspect a journal partition for recovery.",
187
- "POST /v2/recovery/partitions/:id/validate": "Validate a journal partition (dry).",
188
- "POST /v2/recovery/partitions/:id/export": "Export a journal partition (dry).",
189
- "POST /v2/recovery/partitions/:id/quarantine": "Quarantine a corrupt journal partition.",
190
- };
191
115
  const j = (method, path, mutability, requestSchema = null, responseSchema = null, extra = {}) => descriptor({
192
116
  method,
193
117
  path,
@@ -211,6 +135,16 @@ const operations = [
211
135
  idempotency: "natural",
212
136
  }),
213
137
  j("GET", "/v2/agent-capabilities", "read_only", null, "AgentCapabilityCatalog"),
138
+ j("GET", "/v2/run-applicability", "read_only", null, "ControlRunApplicabilityResponse", {
139
+ applicability: "project",
140
+ parameters: [
141
+ queryParam({
142
+ name: "repoRoot",
143
+ required: true,
144
+ description: "Absolute existing project root whose protected-path policy and Git prerequisite should be projected.",
145
+ }),
146
+ ],
147
+ }),
214
148
  j("GET", "/v2/global/events", "read_only", null, null, {
215
149
  responseKind: "stream",
216
150
  parameters: [
@@ -218,7 +152,15 @@ const operations = [
218
152
  ],
219
153
  }),
220
154
  j("GET", "/v2/quota", "read_only", null, "ControlQuotaResponse"),
221
- j("GET", "/v2/credential-profiles", "read_only", null, "ControlCredentialProfilesResponse"),
155
+ j("GET", "/v2/credential-profiles", "read_only", null, "ControlCredentialProfilesQueryResponse", {
156
+ parameters: [
157
+ queryParam({
158
+ name: "snapshot",
159
+ enum: ["true", "false"],
160
+ description: "Return one fresh server-authored Accounts snapshot epoch.",
161
+ }),
162
+ ],
163
+ }),
222
164
  j("POST", "/v2/credential-profiles", "mutating", "ControlCredentialProfileCreateRequest", "ControlCredentialProfileCreateResponse", { idempotency: "natural" }),
223
165
  j("PATCH", "/v2/credential-profiles/:harness/:profileId", "mutating", "ControlCredentialProfileUpdateRequest", "ControlCredentialProfileUpdateResponse", { idempotency: "natural" }),
224
166
  j("DELETE", "/v2/credential-profiles/:harness/:profileId", "mutating", null, "ControlCredentialProfileDeleteResponse", { idempotency: "natural" }),
@@ -245,6 +187,7 @@ const operations = [
245
187
  ],
246
188
  }),
247
189
  j("GET", "/v2/projects", "read_only", null, "ControlProjectListResponse"),
190
+ ...REMOTE_OPERATION_DRAFTS.map(descriptor),
248
191
  j("POST", "/v2/projects", "mutating", "ControlProjectRegisterRequest", "ControlProject", {
249
192
  idempotency: "key_required",
250
193
  }),