@hachej/boring-agent 0.1.104 → 0.1.107

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 (34) hide show
  1. package/dist/{chunk-K25PK5EC.js → chunk-3JFPS2O6.js} +1 -0
  2. package/dist/{chunk-JNEKOVMJ.js → chunk-6OANSUEI.js} +1 -1
  3. package/dist/{chunk-4IQ4HHBG.js → chunk-7XAOVFSN.js} +7 -0
  4. package/dist/{chunk-I7KFNGB4.js → chunk-GS4ADE34.js} +877 -349
  5. package/dist/{chunk-BTYOMR7W.js → chunk-KDXIXVF6.js} +5179 -3668
  6. package/dist/{chunk-6DRHERVK.js → chunk-MVKXLMH3.js} +44 -2
  7. package/dist/chunk-YTUZFKB3.js +78 -0
  8. package/dist/core/index.d.ts +5 -5
  9. package/dist/core/index.js +2 -2
  10. package/dist/{createHarness-POZ4AXCZ.js → createHarness-AHWSC36D.js} +3 -3
  11. package/dist/{errors-DH7C01Pm.d.ts → errors-CEU4iujR.d.ts} +59 -4
  12. package/dist/{file-search-qcD5zItr.d.ts → file-search-BGUHnW9o.d.ts} +3 -3
  13. package/dist/front/index.d.ts +43 -7
  14. package/dist/front/index.js +1505 -729
  15. package/dist/front/styles.css +109 -15
  16. package/dist/{harness-Dcd08yKr.d.ts → harness-Ct0e4RWc.d.ts} +6 -3
  17. package/dist/{lease-DffrPrQn.d.ts → lease-nASWv2tU.d.ts} +1 -1
  18. package/dist/{piChatEvent-iNSXiFQq.d.ts → piChatEvent-BUWIzw5l.d.ts} +67 -36
  19. package/dist/{piChatSessionService-DQSQ_kWZ.d.ts → piChatSessionService-nvroRAVk.d.ts} +13 -11
  20. package/dist/server/agent-host/testing/gatewayConformance.d.ts +6 -5
  21. package/dist/server/agent-host/testing/gatewayConformance.js +57 -8
  22. package/dist/server/index.d.ts +207 -243
  23. package/dist/server/index.js +15 -9
  24. package/dist/server/worker/index.js +7 -7
  25. package/dist/shared/index.d.ts +34 -28
  26. package/dist/shared/index.js +8 -8
  27. package/dist/{types-B1xDlBSo.d.ts → types-B7-PN5jV.d.ts} +75 -23
  28. package/docs/AGENT_GATEWAY_V0.md +40 -2
  29. package/docs/ERROR_CODES.md +2 -1
  30. package/docs/README.md +1 -0
  31. package/docs/SESSION_IDENTITY.md +91 -0
  32. package/docs/tools.md +4 -0
  33. package/package.json +11 -10
  34. package/dist/chunk-WSQ5QNIY.js +0 -18
@@ -1,13 +1,15 @@
1
- import "../../../chunk-JNEKOVMJ.js";
2
- import "../../../chunk-4IQ4HHBG.js";
3
- import "../../../chunk-WSQ5QNIY.js";
1
+ import "../../../chunk-6OANSUEI.js";
2
+ import {
3
+ compareSessionOrder
4
+ } from "../../../chunk-7XAOVFSN.js";
5
+ import "../../../chunk-YTUZFKB3.js";
4
6
  import {
5
7
  AGENT_GATEWAY_ERROR_CODES,
6
8
  AgentGatewayError,
7
9
  AgentGatewayErrorCode
8
- } from "../../../chunk-6DRHERVK.js";
10
+ } from "../../../chunk-MVKXLMH3.js";
9
11
  import "../../../chunk-YGRQ4Q5P.js";
10
- import "../../../chunk-K25PK5EC.js";
12
+ import "../../../chunk-3JFPS2O6.js";
11
13
 
12
14
  // src/server/agent-host/testing/gatewayConformance.ts
13
15
  import { describe, expect, it } from "vitest";
@@ -43,6 +45,7 @@ function gatewayConformance(options) {
43
45
  await expectCode(fixture.gateway.connectSession({ scope: denied, ref }), "AGENT_SCOPE_DENIED");
44
46
  await expectCode(fixture.gateway.readSessionState({ scope: denied, ref }), "AGENT_SCOPE_DENIED");
45
47
  await expectCode(fixture.gateway.renameSession({ scope: denied, ref, requestId: `denied-rename-${index}`, title: "x" }), "AGENT_SCOPE_DENIED");
48
+ await expectCode(fixture.gateway.setSessionArchived({ scope: denied, ref, requestId: `denied-archive-${index}`, archived: true }), "AGENT_SCOPE_DENIED");
46
49
  await expectCode(fixture.gateway.deleteSession({ scope: denied, ref, requestId: `denied-delete-${index}` }), "AGENT_SCOPE_DENIED");
47
50
  }
48
51
  });
@@ -63,6 +66,9 @@ function gatewayConformance(options) {
63
66
  "AGENT_TYPE_UNKNOWN",
64
67
  "AGENT_SESSION_NOT_FOUND",
65
68
  "AGENT_SCOPE_DENIED",
69
+ "AGENT_ENTITLEMENT_REQUIRED",
70
+ "AGENT_ACCESS_FORBIDDEN",
71
+ "AGENT_ACCESS_POLICY_UNAVAILABLE",
66
72
  "AGENT_SESSION_REPLAY_GAP",
67
73
  "AGENT_SESSION_CURSOR_AHEAD",
68
74
  "AGENT_SESSION_CURSOR_EXPIRED",
@@ -97,6 +103,14 @@ function gatewayConformance(options) {
97
103
  expect((await fixture.gateway.readSessionState({ scope, ref })).summary.title).toBe(`${requestId}-session`);
98
104
  }
99
105
  },
106
+ {
107
+ effect: "session.archive",
108
+ run: async (fixture, scope, requestId) => {
109
+ const ref = await createSession(fixture, scope, `${requestId}-session`);
110
+ await expectCode(fixture.gateway.setSessionArchived({ scope, ref, requestId, archived: true }), "AGENT_SCOPE_DENIED");
111
+ expect((await fixture.gateway.listSessions({ scope, archived: "active" })).sessions).toContainEqual(expect.objectContaining({ ref }));
112
+ }
113
+ },
100
114
  {
101
115
  effect: "session.delete",
102
116
  run: async (fixture, scope, requestId) => {
@@ -253,9 +267,42 @@ function gatewayConformance(options) {
253
267
  "AGENT_REQUEST_CONFLICT"
254
268
  );
255
269
  await expect(fixture.gateway.renameSession({ scope: scopeA, ref: second, requestId: "shared-target-id", title: "two" })).resolves.toMatchObject({ title: "two" });
270
+ const archived = await fixture.gateway.setSessionArchived({
271
+ scope: scopeA,
272
+ ref: first,
273
+ requestId: "archive-id",
274
+ archived: true
275
+ });
276
+ expect(archived.archived).toBe(true);
277
+ await expect(fixture.gateway.setSessionArchived({
278
+ scope: scopeA,
279
+ ref: first,
280
+ requestId: "archive-id",
281
+ archived: true
282
+ })).resolves.toEqual(archived);
283
+ await expectCode(fixture.gateway.setSessionArchived({
284
+ scope: scopeA,
285
+ ref: first,
286
+ requestId: "archive-id",
287
+ archived: false
288
+ }), "AGENT_REQUEST_CONFLICT");
256
289
  await fixture.gateway.deleteSession({ scope: scopeA, ref: second, requestId: "delete-id" });
257
290
  await expect(fixture.gateway.deleteSession({ scope: scopeA, ref: second, requestId: "delete-id" })).resolves.toBeUndefined();
258
291
  });
292
+ it("replays a completed archive receipt after the session is deleted", async () => {
293
+ const fixture = await options.createFixture();
294
+ const scope = fixture.issueScope();
295
+ const ref = await createSession(fixture, scope, "archive-then-delete");
296
+ const archiveRequest = {
297
+ scope,
298
+ ref,
299
+ requestId: "archive-before-delete",
300
+ archived: true
301
+ };
302
+ const archived = await fixture.gateway.setSessionArchived(archiveRequest);
303
+ await fixture.gateway.deleteSession({ scope, ref, requestId: "delete-after-archive" });
304
+ await expect(fixture.gateway.setSessionArchived(archiveRequest)).resolves.toEqual(archived);
305
+ });
259
306
  it("enforces command states, queue controls, typed receipts, and command idempotency", async () => {
260
307
  const fixture = await options.createFixture();
261
308
  const scope = fixture.issueScope();
@@ -492,10 +539,12 @@ function gatewayConformance(options) {
492
539
  await expectCode(fixture.gateway.listSessions({ scope: scopeB, cursor, limit: 1 }), "AGENT_SESSION_CURSOR_INVALID");
493
540
  await expectCode(fixture.gateway.listSessions({ scope: scopeA, cursor, limit: 2 }), "AGENT_SESSION_CURSOR_INVALID");
494
541
  await expectCode(fixture.gateway.listSessions({ scope: scopeA, cursor, agentTypeId: "alpha", limit: 1 }), "AGENT_SESSION_CURSOR_INVALID");
542
+ await expectCode(fixture.gateway.listSessions({ scope: scopeA, cursor, archived: "active", limit: 1 }), "AGENT_SESSION_CURSOR_INVALID");
495
543
  const all = await fixture.gateway.listSessions({ scope: scopeA, limit: 20 });
496
- expect(all.sessions).toEqual([...all.sessions].sort(
497
- (left, right) => right.updatedAt - left.updatedAt || left.ref.agentTypeId.localeCompare(right.ref.agentTypeId) || left.ref.sessionId.localeCompare(right.ref.sessionId)
498
- ));
544
+ expect(all.sessions).toEqual([...all.sessions].sort((left, right) => compareSessionOrder(
545
+ [left.updatedAt, left.ref.agentTypeId, left.ref.sessionId],
546
+ [right.updatedAt, right.ref.agentTypeId, right.ref.sessionId]
547
+ )));
499
548
  expect(all.sessions.map((session) => session.ref)).toEqual([alphaA, alphaC, beta]);
500
549
  });
501
550
  it("documents keyset mutation behavior: moved rows may shift and deleted rows disappear", async () => {