@agentknight/sdk 0.9.53 → 0.9.56

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.
@@ -3,7 +3,7 @@ import {
3
3
  SessionCommunicationDataSchema,
4
4
  SessionNameSchema,
5
5
  WorkbenchOperationStatusSchema
6
- } from "./chunk-UZFIXIAS.js";
6
+ } from "./chunk-K5CMKBW6.js";
7
7
 
8
8
  // src/session-operations.ts
9
9
  import { createHash, randomUUID } from "node:crypto";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CODING_AGENT_IDS
3
- } from "./chunk-ML6Q2MYH.js";
3
+ } from "./chunk-L3A736SO.js";
4
4
  import {
5
5
  SECURE_MESSAGE_MAX_CIPHERTEXT_LENGTH
6
- } from "./chunk-UZFIXIAS.js";
6
+ } from "./chunk-K5CMKBW6.js";
7
7
 
8
8
  // src/agent-selection.ts
9
9
  import { z } from "zod";
@@ -14,26 +14,14 @@ function codingAgentPresentation(agentId) {
14
14
  return Object.hasOwn(presentations, agentId) ? presentations[agentId] : fallback;
15
15
  }
16
16
 
17
- // src/config.ts
18
- import { z } from "zod";
19
- var SessionImagesConfigSchema = z.object({
20
- allowUnencryptedStorage: z.literal(true),
21
- storageAccount: z.string().regex(/^[a-z0-9]{3,24}$/u),
22
- storageContainer: z.string().min(3).max(63).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/u)
23
- }).strict();
24
- var SessionImageRelayUrlSchema = z.url().refine((value) => {
25
- const url = new URL(value);
26
- return /^https:\/\/[^/?#\\@\s\x00-\x1f\x7f]+\/?$/iu.test(value) && url.protocol === "https:" && url.username === "" && url.password === "" && url.pathname === "/" && url.search === "" && url.hash === "";
27
- }, "Session images require an HTTPS Relay origin without a path, credentials, query or fragment").transform((value) => new URL(value).origin);
28
-
29
17
  // src/device-identity.ts
30
- import { z as z2 } from "zod";
31
- var DeviceIdentitySchema = z2.object({
32
- schemaVersion: z2.literal(2),
33
- machineId: z2.uuid(),
34
- stableDeviceId: z2.uuid(),
35
- machineName: z2.string().trim().min(1).max(120),
36
- createdAt: z2.iso.datetime({ offset: true })
18
+ import { z } from "zod";
19
+ var DeviceIdentitySchema = z.object({
20
+ schemaVersion: z.literal(2),
21
+ machineId: z.uuid(),
22
+ stableDeviceId: z.uuid(),
23
+ machineName: z.string().trim().min(1).max(120),
24
+ createdAt: z.iso.datetime({ offset: true })
37
25
  });
38
26
 
39
27
  // src/relay-authorization.ts
@@ -48,8 +36,6 @@ async function relayRequestToken(config) {
48
36
 
49
37
  export {
50
38
  codingAgentPresentation,
51
- SessionImagesConfigSchema,
52
- SessionImageRelayUrlSchema,
53
39
  DeviceIdentitySchema,
54
40
  relayRequestToken
55
41
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  IdSchema
3
- } from "./chunk-UZFIXIAS.js";
3
+ } from "./chunk-K5CMKBW6.js";
4
4
 
5
5
  // src/data-directory.ts
6
6
  import { randomUUID } from "node:crypto";
@@ -3,18 +3,18 @@ import {
3
3
  } from "./chunk-T6226JFS.js";
4
4
  import {
5
5
  latestPreviewItems
6
- } from "./chunk-2CNJAMAN.js";
6
+ } from "./chunk-5J7BK2Y7.js";
7
7
  import {
8
8
  UnsupportedAgentOperationError,
9
9
  validateSessionName
10
- } from "./chunk-ML6Q2MYH.js";
10
+ } from "./chunk-L3A736SO.js";
11
11
  import {
12
12
  ConversationItemSchema,
13
13
  InteractionRequestSchema,
14
14
  InteractionResponseSchema,
15
15
  SESSION_TIMELINE_PAGE_SIZE,
16
16
  SessionSummarySchema
17
- } from "./chunk-UZFIXIAS.js";
17
+ } from "./chunk-K5CMKBW6.js";
18
18
 
19
19
  // src/claude-adapter.ts
20
20
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  latestPreviewItems
3
- } from "./chunk-2CNJAMAN.js";
3
+ } from "./chunk-5J7BK2Y7.js";
4
4
  import {
5
5
  UnsupportedAgentOperationError
6
- } from "./chunk-ML6Q2MYH.js";
6
+ } from "./chunk-L3A736SO.js";
7
7
  import {
8
8
  ConversationItemSchema,
9
9
  InteractionRequestSchema,
10
10
  SESSION_TIMELINE_PAGE_SIZE,
11
11
  SessionSummarySchema
12
- } from "./chunk-UZFIXIAS.js";
12
+ } from "./chunk-K5CMKBW6.js";
13
13
 
14
14
  // src/codex-adapter.ts
15
15
  import { randomUUID } from "node:crypto";
@@ -18,25 +18,26 @@ import {
18
18
  recordTimelineSyncDiagnostic,
19
19
  resolveGitProjectIdentity,
20
20
  sanitizeGitRemoteUrl
21
- } from "./chunk-6YFGVYI5.js";
21
+ } from "./chunk-6ZPE7VIE.js";
22
+ import "./chunk-IJPJQF7S.js";
22
23
  import {
23
24
  assertMainSessionId,
24
25
  isResearchSessionId
25
- } from "./chunk-HJCNQM4M.js";
26
+ } from "./chunk-E7QL4CBT.js";
26
27
  import {
27
28
  GroupChatError,
28
29
  GroupChatMessageSchema,
29
30
  GroupChatRuntime
30
- } from "./chunk-XL6UB4C3.js";
31
+ } from "./chunk-HFVA7ZOD.js";
31
32
  import {
32
33
  isContentfulAssistant
33
- } from "./chunk-2CNJAMAN.js";
34
+ } from "./chunk-5J7BK2Y7.js";
34
35
  import {
35
36
  AgentSessionRenameError,
36
37
  SessionOperationError,
37
38
  TimelinePageBudgetError,
38
39
  validateSessionName
39
- } from "./chunk-ML6Q2MYH.js";
40
+ } from "./chunk-L3A736SO.js";
40
41
  import {
41
42
  ConversationItemSchema,
42
43
  CopilotModelOptionSchema,
@@ -57,7 +58,7 @@ import {
57
58
  WorkbenchScheduleEntrySchema,
58
59
  WorkbenchScheduleProposalSchema,
59
60
  WorkbenchScheduleSnapshotSchema
60
- } from "./chunk-UZFIXIAS.js";
61
+ } from "./chunk-K5CMKBW6.js";
61
62
 
62
63
  // src/copilot-adapter.ts
63
64
  import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
@@ -2501,7 +2502,10 @@ var SessionSchedules = class {
2501
2502
  }
2502
2503
  return { connection, session, schedule: session.rpc.schedule, invoke: session.rpc.commands.invoke };
2503
2504
  }
2504
- async snapshot(sessionId) {
2505
+ snapshot(sessionId) {
2506
+ return this.#snapshot(sessionId, true);
2507
+ }
2508
+ async #snapshot(sessionId, readHistory) {
2505
2509
  this.options.assertAvailable(sessionId);
2506
2510
  const connection = this.options.current(sessionId);
2507
2511
  const drafts = await this.#drafts.list(sessionId);
@@ -2518,7 +2522,10 @@ var SessionSchedules = class {
2518
2522
  });
2519
2523
  }
2520
2524
  const { session, schedule } = await this.#active(sessionId);
2521
- const [native, history] = await Promise.all([schedule.list(), session.getEvents?.()]);
2525
+ const [native, history] = await Promise.all([
2526
+ schedule.list(),
2527
+ readHistory ? session.getEvents?.() : void 0
2528
+ ]);
2522
2529
  this.#check(sessionId, connection);
2523
2530
  const entries = NativeList.parse(native).entries.map(({ tz, at, ...entry }) => ({
2524
2531
  ...entry,
@@ -2532,7 +2539,10 @@ var SessionSchedules = class {
2532
2539
  sampledAt: (/* @__PURE__ */ new Date()).toISOString(),
2533
2540
  timezone: new Intl.DateTimeFormat("en").resolvedOptions().timeZone,
2534
2541
  ...workingDirectory === void 0 ? {} : { workingDirectory },
2535
- ...projectScheduleHistory(history ?? [])
2542
+ ...readHistory ? projectScheduleHistory(history ?? []) : {
2543
+ results: this.#cache.get(sessionId)?.results ?? [],
2544
+ historyTruncated: true
2545
+ }
2536
2546
  });
2537
2547
  if (entries.length > 0) this.#activePlans.add(sessionId);
2538
2548
  else this.#activePlans.delete(sessionId);
@@ -2678,7 +2688,9 @@ var SessionSchedules = class {
2678
2688
  assertAccess?.();
2679
2689
  if (result.entry !== void 0 && result.entry.id !== id) throw new Error("Native schedule identity mismatch");
2680
2690
  this.#check(sessionId, connection);
2681
- const snapshot = await this.snapshot(sessionId);
2691
+ const snapshot = await this.#snapshot(sessionId, false);
2692
+ this.#check(sessionId, connection);
2693
+ assertAccess?.();
2682
2694
  if (snapshot.entries.some((entry) => entry.id === id)) throw new Error("Native schedule is still present");
2683
2695
  this.options.changed(sessionId);
2684
2696
  return { snapshot, removed: result.entry !== void 0 };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  AgentSelectionSchema,
3
3
  assertSelectionSnapshotFits
4
- } from "./chunk-AAZH6QGV.js";
4
+ } from "./chunk-NTFNQYQ3.js";
5
5
  import {
6
6
  isResearchSessionId
7
- } from "./chunk-HJCNQM4M.js";
7
+ } from "./chunk-E7QL4CBT.js";
8
8
  import {
9
9
  GroupChatError
10
- } from "./chunk-XL6UB4C3.js";
10
+ } from "./chunk-HFVA7ZOD.js";
11
11
  import {
12
12
  AgentModelListingError,
13
13
  AgentSessionRenameError,
@@ -16,11 +16,11 @@ import {
16
16
  UnsupportedAgentOperationError,
17
17
  captureWorkbenchAccess,
18
18
  validateSessionName
19
- } from "./chunk-ML6Q2MYH.js";
19
+ } from "./chunk-L3A736SO.js";
20
20
  import {
21
21
  InteractionResponseSchema,
22
22
  SessionSummarySchema
23
- } from "./chunk-UZFIXIAS.js";
23
+ } from "./chunk-K5CMKBW6.js";
24
24
 
25
25
  // src/managed-agent-adapter.ts
26
26
  import { createHash, randomUUID } from "node:crypto";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  latestPreviewItems
3
- } from "./chunk-2CNJAMAN.js";
3
+ } from "./chunk-5J7BK2Y7.js";
4
4
  import {
5
5
  AgentSessionRenameError,
6
6
  UnsupportedAgentOperationError,
7
7
  validateSessionName
8
- } from "./chunk-ML6Q2MYH.js";
8
+ } from "./chunk-L3A736SO.js";
9
9
  import {
10
10
  InteractionRequestSchema,
11
11
  REASONING_EFFORTS,
12
12
  SESSION_TIMELINE_PAGE_SIZE
13
- } from "./chunk-UZFIXIAS.js";
13
+ } from "./chunk-K5CMKBW6.js";
14
14
 
15
15
  // src/pi-adapter.ts
16
16
  import { createHash as createHash2, randomUUID } from "node:crypto";
@@ -1,17 +1,19 @@
1
1
  import {
2
2
  DeviceIdentitySchema,
3
- SessionImageRelayUrlSchema,
4
- SessionImagesConfigSchema,
5
3
  codingAgentPresentation,
6
4
  relayRequestToken
7
- } from "./chunks/chunk-EFRYPUKX.js";
5
+ } from "./chunks/chunk-XPHAIOKN.js";
8
6
  import {
9
7
  AgentSelectionSchema
10
- } from "./chunks/chunk-AAZH6QGV.js";
8
+ } from "./chunks/chunk-NTFNQYQ3.js";
9
+ import {
10
+ SessionImageRelayUrlSchema,
11
+ SessionImagesConfigSchema
12
+ } from "./chunks/chunk-IJPJQF7S.js";
11
13
  import {
12
14
  CODING_AGENT_IDS
13
- } from "./chunks/chunk-ML6Q2MYH.js";
14
- import "./chunks/chunk-UZFIXIAS.js";
15
+ } from "./chunks/chunk-L3A736SO.js";
16
+ import "./chunks/chunk-K5CMKBW6.js";
15
17
  export {
16
18
  AgentSelectionSchema,
17
19
  CODING_AGENT_IDS,
package/dist/index.d.ts CHANGED
@@ -2095,12 +2095,13 @@ declare const UploaderConfigSchema: z.ZodObject<{
2095
2095
  }, z.core.$strip>;
2096
2096
  type SessionImageUploaderConfig = z.input<typeof UploaderConfigSchema>;
2097
2097
  type Stage = "config" | "source" | "reserve" | "put" | "complete";
2098
- type SessionImageUploadErrorCode = "IMAGE_CONFIG_INVALID" | "IMAGE_CONTENT_INVALID" | "IMAGE_CAPACITY_EXCEEDED" | "IMAGE_UPLOADER_CLOSED" | "IMAGE_ABORTED" | "IMAGE_TIMEOUT" | "IMAGE_NETWORK_ERROR" | "IMAGE_HTTP_ERROR" | "IMAGE_RESPONSE_INVALID" | "IMAGE_RESPONSE_TOO_LARGE" | "IMAGE_UPLOAD_TARGET_INVALID" | "IMAGE_UPLOAD_EXPIRED" | "IMAGE_COMMIT_MISMATCH" | "IMAGE_COMPLETION_FAILED" | "IMAGE_ACCESS_REVOKED" | "IMAGE_STORAGE_UNAVAILABLE";
2098
+ type SessionImageUploadErrorCode = "IMAGE_CONFIG_INVALID" | "IMAGE_CONTENT_INVALID" | "IMAGE_CAPACITY_EXCEEDED" | "IMAGE_UPLOADER_CLOSED" | "IMAGE_ABORTED" | "IMAGE_TIMEOUT" | "IMAGE_NETWORK_ERROR" | "IMAGE_HTTP_ERROR" | "IMAGE_RESPONSE_INVALID" | "IMAGE_RESPONSE_TOO_LARGE" | "IMAGE_UPLOAD_TARGET_INVALID" | "IMAGE_UPLOAD_EXPIRED" | "IMAGE_COMMIT_MISMATCH" | "IMAGE_COMPLETION_FAILED" | "IMAGE_ACCESS_REVOKED" | "IMAGE_STORAGE_UNAVAILABLE" | "IMAGE_QUOTA_EXCEEDED" | "IMAGE_BUSY";
2099
2099
  /** Safe to log: never retains a response body, URL, token, or raw transport/schema error. */
2100
2100
  declare class SessionImageUploadError extends Error {
2101
2101
  readonly code: SessionImageUploadErrorCode;
2102
2102
  readonly stage: Stage;
2103
2103
  readonly status?: number | undefined;
2104
+ retryAfterMs?: number;
2104
2105
  constructor(code: SessionImageUploadErrorCode, stage: Stage, status?: number | undefined, cause?: unknown);
2105
2106
  }
2106
2107
  /** Uploads already-derived WebP bytes only. Consent and session authorization belong to the caller. */