agent-dealer 1.4.4 → 1.4.5

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 (62) hide show
  1. package/bundle/server/dist/adapters/muse-capability.js +81 -8
  2. package/bundle/server/dist/adapters/muse-capability.test.js +89 -1
  3. package/bundle/server/dist/coordinator/commands.js +2 -1
  4. package/bundle/server/package.json +2 -2
  5. package/bundle/server/static-ui/assets/index-2IuALSbV.js +64 -0
  6. package/bundle/server/static-ui/assets/index-MgimDoh2.css +1 -0
  7. package/bundle/server/static-ui/index.html +2 -2
  8. package/bundle/shared/package.json +1 -1
  9. package/dist/bin.js +0 -0
  10. package/package.json +2 -3
  11. package/bundle/server/dist/adapters/authority-lifecycle.js +0 -289
  12. package/bundle/server/dist/adapters/execution-authority.js +0 -103
  13. package/bundle/server/dist/adapters/execution-authority.test.js +0 -166
  14. package/bundle/server/dist/adapters/external.js +0 -20
  15. package/bundle/server/dist/coordinator/authority-recovery.integration.test.js +0 -661
  16. package/bundle/server/dist/coordinator/dispatcher.js +0 -58
  17. package/bundle/server/dist/coordinator/dispatcher.test.js +0 -81
  18. package/bundle/server/dist/coordinator/intent-forecast.js +0 -13
  19. package/bundle/server/dist/coordinator/intent-forecast.test.js +0 -34
  20. package/bundle/server/dist/coordinator/session-lifecycle.integration.test.js +0 -127
  21. package/bundle/server/dist/coordinator/session-lifecycle.js +0 -280
  22. package/bundle/server/dist/coordinator/session-lifecycle.test.js +0 -121
  23. package/bundle/server/dist/db/authority-attempts-stale-at-migration.test.js +0 -65
  24. package/bundle/server/dist/intake/agent-routing.js +0 -32
  25. package/bundle/server/dist/queue/answers.test.js +0 -117
  26. package/bundle/server/dist/queue/dispatcher-recovery.test.js +0 -37
  27. package/bundle/server/dist/queue/dispatcher.js +0 -597
  28. package/bundle/server/dist/queue/plan-delegation.js +0 -27
  29. package/bundle/server/dist/queue/plan-delegation.test.js +0 -61
  30. package/bundle/server/dist/queue/plan-gate.test.js +0 -55
  31. package/bundle/server/dist/queue/result-qa.js +0 -66
  32. package/bundle/server/dist/queue/result-qa.test.js +0 -146
  33. package/bundle/server/dist/repository/authority-attempts.js +0 -189
  34. package/bundle/server/dist/repository/result-qa.js +0 -37
  35. package/bundle/server/dist/runners/codex-args.js +0 -59
  36. package/bundle/server/dist/runners/codex-args.test.js +0 -72
  37. package/bundle/server/dist/runners/codex-resume.test.js +0 -19
  38. package/bundle/server/dist/runners/codex.js +0 -46
  39. package/bundle/server/dist/runners/muse-code-settings.js +0 -23
  40. package/bundle/server/dist/runners/muse-code-settings.test.js +0 -18
  41. package/bundle/server/dist/runners/persist.js +0 -142
  42. package/bundle/server/dist/runners/qa.js +0 -54
  43. package/bundle/server/dist/runners/run-context.js +0 -183
  44. package/bundle/server/dist/runners/stream-json.test.js +0 -95
  45. package/bundle/server/dist/trace-summary.js +0 -93
  46. package/bundle/server/dist/usage-summary.js +0 -61
  47. package/bundle/server/dist/usage-summary.test.js +0 -33
  48. package/bundle/server/static-ui/assets/index-CHCiztRI.css +0 -1
  49. package/bundle/server/static-ui/assets/index-CrLQFFpw.js +0 -64
  50. package/bundle/server/static-ui/fonts/Monaco.ttf +0 -0
  51. package/bundle/shared/dist/cursor-auth-health.d.ts +0 -12
  52. package/bundle/shared/dist/cursor-auth-health.js +0 -36
  53. package/bundle/shared/dist/cursor-auth-health.test.d.ts +0 -1
  54. package/bundle/shared/dist/cursor-auth-health.test.js +0 -40
  55. package/bundle/shared/dist/plan-triage.d.ts +0 -317
  56. package/bundle/shared/dist/plan-triage.js +0 -65
  57. package/bundle/shared/dist/plan-triage.test.d.ts +0 -1
  58. package/bundle/shared/dist/plan-triage.test.js +0 -66
  59. package/bundle/shared/dist/result-qa.d.ts +0 -45
  60. package/bundle/shared/dist/result-qa.js +0 -25
  61. package/bundle/shared/dist/result-qa.test.d.ts +0 -1
  62. package/bundle/shared/dist/result-qa.test.js +0 -60
@@ -1,166 +0,0 @@
1
- // packages/server/src/adapters/execution-authority.test.ts
2
- //
3
- // mintAuthority/revokeAuthority never throw — every Deck failure (missing enrollment,
4
- // a typed contract error, or the backend being unreachable) comes back as a typed result
5
- // the caller branches on (NOT-87).
6
- import { test, mock } from "node:test";
7
- import assert from "node:assert/strict";
8
- import fs from "node:fs";
9
- import os from "node:os";
10
- import path from "node:path";
11
- process.env.AGENT_DEALER_HOME = fs.mkdtempSync(path.join(os.tmpdir(), "dealer-execauth-"));
12
- const { migrate } = await import("../db/index.js");
13
- const { mintAuthority, revokeAuthority } = await import("./execution-authority.js");
14
- migrate();
15
- const ENV_KEYS = ["AGENT_DECK_COORDINATOR_ID", "AGENT_DECK_ENROLLMENT_ID", "AGENT_DECK_ENROLLMENT_SECRET"];
16
- function withEnv(vars, fn) {
17
- const saved = Object.fromEntries(ENV_KEYS.map((k) => [k, process.env[k]]));
18
- for (const k of ENV_KEYS) {
19
- if (vars[k] === undefined)
20
- delete process.env[k];
21
- else
22
- process.env[k] = vars[k];
23
- }
24
- return fn().finally(() => {
25
- for (const k of ENV_KEYS) {
26
- if (saved[k] === undefined)
27
- delete process.env[k];
28
- else
29
- process.env[k] = saved[k];
30
- }
31
- });
32
- }
33
- const ENROLLED = {
34
- AGENT_DECK_COORDINATOR_ID: "coord-1",
35
- AGENT_DECK_ENROLLMENT_ID: "enr_abc",
36
- AGENT_DECK_ENROLLMENT_SECRET: "enrs_secret",
37
- };
38
- const MINT_INPUT = {
39
- runId: "run-1",
40
- attemptId: "attempt-1",
41
- deckId: "deck-1",
42
- ttlMs: 60_000,
43
- idempotencyKey: "attempt-1",
44
- };
45
- test("mintAuthority returns COORDINATOR_NOT_ENROLLED without calling fetch when no enrollment env is set", async () => {
46
- await withEnv({}, async () => {
47
- const fetchMock = mock.method(globalThis, "fetch", async () => {
48
- throw new Error("fetch should not be called");
49
- });
50
- try {
51
- const result = await mintAuthority(MINT_INPUT);
52
- assert.equal(result.ok, false);
53
- if (!result.ok)
54
- assert.equal(result.code, "COORDINATOR_NOT_ENROLLED");
55
- assert.equal(fetchMock.mock.callCount(), 0);
56
- }
57
- finally {
58
- fetchMock.mock.restore();
59
- }
60
- });
61
- });
62
- test("mintAuthority sends the enrollment bearer and returns the minted authority on success", async () => {
63
- await withEnv(ENROLLED, async () => {
64
- let capturedUrl = "";
65
- let capturedAuth = "";
66
- let capturedBody = {};
67
- const fetchMock = mock.method(globalThis, "fetch", async (url, init) => {
68
- capturedUrl = String(url);
69
- capturedAuth = init?.headers?.Authorization ?? "";
70
- capturedBody = JSON.parse(String(init?.body ?? "{}"));
71
- return new Response(JSON.stringify({
72
- ok: true,
73
- data: {
74
- authority: {
75
- authorityId: "authz_1",
76
- deckId: "deck-1",
77
- audience: "dealer-worker",
78
- allowedServices: ["slack"],
79
- allowedTools: [{ serviceId: "slack", toolName: "send_message" }],
80
- expiresAt: "2026-01-01T00:01:00Z",
81
- },
82
- authoritySecret: "authzs_secret",
83
- secretIssued: true,
84
- },
85
- }), { status: 200 });
86
- });
87
- try {
88
- const result = await mintAuthority(MINT_INPUT);
89
- assert.equal(result.ok, true);
90
- if (result.ok) {
91
- assert.equal(result.authority.authorityId, "authz_1");
92
- assert.equal(result.authority.authoritySecret, "authzs_secret");
93
- assert.deepEqual(result.authority.allowedTools, [{ serviceId: "slack", toolName: "send_message" }]);
94
- }
95
- assert.match(capturedUrl, /\/api\/execution-authority\/authorities$/);
96
- assert.equal(capturedAuth, "Bearer enr_abc:enrs_secret");
97
- assert.equal(capturedBody.runId, "run-1");
98
- assert.equal(capturedBody.idempotencyKey, "attempt-1");
99
- assert.equal(capturedBody.audience, "dealer-worker");
100
- }
101
- finally {
102
- fetchMock.mock.restore();
103
- }
104
- });
105
- });
106
- test("mintAuthority maps a typed contract error (INTERACTION_REQUIRED) instead of throwing", async () => {
107
- await withEnv(ENROLLED, async () => {
108
- const fetchMock = mock.method(globalThis, "fetch", async () => {
109
- return new Response(JSON.stringify({ ok: false, error_code: "INTERACTION_REQUIRED", message: "Control-plane decision required" }), { status: 409 });
110
- });
111
- try {
112
- const result = await mintAuthority(MINT_INPUT);
113
- assert.equal(result.ok, false);
114
- if (!result.ok) {
115
- assert.equal(result.code, "INTERACTION_REQUIRED");
116
- assert.equal(result.message, "Control-plane decision required");
117
- }
118
- }
119
- finally {
120
- fetchMock.mock.restore();
121
- }
122
- });
123
- });
124
- test("mintAuthority maps a network failure to DECK_UNAVAILABLE", async () => {
125
- await withEnv(ENROLLED, async () => {
126
- const fetchMock = mock.method(globalThis, "fetch", async () => {
127
- throw new Error("ECONNREFUSED");
128
- });
129
- try {
130
- const result = await mintAuthority(MINT_INPUT);
131
- assert.equal(result.ok, false);
132
- if (!result.ok)
133
- assert.equal(result.code, "DECK_UNAVAILABLE");
134
- }
135
- finally {
136
- fetchMock.mock.restore();
137
- }
138
- });
139
- });
140
- test("revokeAuthority is a best-effort no-op when unreachable (never throws)", async () => {
141
- await withEnv(ENROLLED, async () => {
142
- const fetchMock = mock.method(globalThis, "fetch", async () => {
143
- throw new Error("ECONNREFUSED");
144
- });
145
- try {
146
- await assert.doesNotReject(revokeAuthority("authz_1"));
147
- }
148
- finally {
149
- fetchMock.mock.restore();
150
- }
151
- });
152
- });
153
- test("revokeAuthority skips the call entirely when not enrolled", async () => {
154
- await withEnv({}, async () => {
155
- const fetchMock = mock.method(globalThis, "fetch", async () => {
156
- throw new Error("fetch should not be called");
157
- });
158
- try {
159
- await revokeAuthority("authz_1");
160
- assert.equal(fetchMock.mock.callCount(), 0);
161
- }
162
- finally {
163
- fetchMock.mock.restore();
164
- }
165
- });
166
- });
@@ -1,20 +0,0 @@
1
- import { listLinearCandidates } from "./linear-inbox.js";
2
- export async function pollLinearIssues() {
3
- if (process.env.LINEAR_AUTO_ENQUEUE === "1") {
4
- console.warn("[linear] LINEAR_AUTO_ENQUEUE=1 is deprecated — use Intake promote");
5
- return 0;
6
- }
7
- if (!process.env.LINEAR_API_KEY)
8
- return 0;
9
- try {
10
- const candidates = await listLinearCandidates();
11
- if (candidates.length > 0) {
12
- console.log(`[linear] ${candidates.length} inbox candidate(s) — promote via Intake`);
13
- }
14
- return 0;
15
- }
16
- catch (e) {
17
- console.error("[linear]", e);
18
- return 0;
19
- }
20
- }