@agentknight/sdk 0.9.48 → 0.9.50

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.
@@ -0,0 +1,25 @@
1
+ import {
2
+ DeviceIdentitySchema,
3
+ LEGACY_CLIENT_STATE_DIRECTORY,
4
+ SessionImageRelayUrlSchema,
5
+ SessionImagesConfigSchema,
6
+ codingAgentPresentation,
7
+ relayRequestToken
8
+ } from "./chunks/chunk-RPVK6HQV.js";
9
+ import {
10
+ AgentSelectionSchema
11
+ } from "./chunks/chunk-HHI2UYWK.js";
12
+ import {
13
+ CODING_AGENT_IDS
14
+ } from "./chunks/chunk-4XVACOU5.js";
15
+ import "./chunks/chunk-BMMKEB6V.js";
16
+ export {
17
+ AgentSelectionSchema,
18
+ CODING_AGENT_IDS,
19
+ DeviceIdentitySchema,
20
+ LEGACY_CLIENT_STATE_DIRECTORY,
21
+ SessionImageRelayUrlSchema,
22
+ SessionImagesConfigSchema,
23
+ codingAgentPresentation,
24
+ relayRequestToken
25
+ };
package/dist/index.d.ts CHANGED
@@ -25,6 +25,29 @@ declare const PairingStatusSchema: z.ZodEnum<{
25
25
  }>;
26
26
  type PairingStatus = z.infer<typeof PairingStatusSchema>;
27
27
 
28
+ declare const MobileAuthorizationViewSchema: z.ZodObject<{
29
+ requestId: z.ZodString;
30
+ state: z.ZodEnum<{
31
+ active: "active";
32
+ cancelled: "cancelled";
33
+ expired: "expired";
34
+ open: "open";
35
+ pending: "pending";
36
+ rejected: "rejected";
37
+ revoked: "revoked";
38
+ }>;
39
+ deviceName: z.ZodString;
40
+ clientId: z.ZodString;
41
+ publicKey: z.ZodString;
42
+ confirmationCode: z.ZodString;
43
+ createdAt: z.ZodNumber;
44
+ expiresAt: z.ZodNumber;
45
+ decidedAt: z.ZodNullable<z.ZodNumber>;
46
+ lastSeenAt: z.ZodNullable<z.ZodNumber>;
47
+ online: z.ZodBoolean;
48
+ }, z.core.$strip>;
49
+ type MobileAuthorizationView = z.infer<typeof MobileAuthorizationViewSchema>;
50
+
28
51
  declare const SecureEventNameSchema: z.ZodEnum<{
29
52
  "conversation.activity.step.upsert": "conversation.activity.step.upsert";
30
53
  "conversation.item.upsert": "conversation.item.upsert";
@@ -1781,9 +1804,19 @@ interface SelectableAgent {
1781
1804
  interface AgentSelectionProvider {
1782
1805
  listAgents(): Promise<SelectableAgent[]>;
1783
1806
  saveSelection(selection: AgentSelection): Promise<void>;
1807
+ readLocalSessionTimelinePage?(sessionId: string, options?: Pick<TimelineReadOptions, "cursor" | "pageSize">): ReturnType<CodingAgentAdapter["readSessionTimelinePage"]>;
1784
1808
  }
1785
1809
  declare function supportsAgentSelection(adapter: CodingAgentAdapter): adapter is CodingAgentAdapter & AgentSelectionProvider;
1786
1810
 
1811
+ interface RelayAccessToken {
1812
+ token: string;
1813
+ expiresAt: number;
1814
+ }
1815
+ interface RelayAuthorization {
1816
+ getAccessToken(): Promise<RelayAccessToken>;
1817
+ }
1818
+ declare function relayRequestToken(config: Pick<PcAgentConfig, "relayToken" | "relayAuthorization">): Promise<string>;
1819
+
1787
1820
  declare const SessionImagesConfigSchema: z.ZodObject<{
1788
1821
  allowUnencryptedStorage: z.ZodLiteral<true>;
1789
1822
  storageAccount: z.ZodString;
@@ -1817,6 +1850,7 @@ type CodingAgentConfig = {
1817
1850
  interface PcAgentConfig {
1818
1851
  relayUrl: string;
1819
1852
  relayToken: string;
1853
+ relayAuthorization?: RelayAuthorization;
1820
1854
  userId: string;
1821
1855
  workspaceRoot?: string;
1822
1856
  dataDirectory: string;
@@ -1896,6 +1930,9 @@ interface PairingProvider {
1896
1930
  readonly force?: boolean;
1897
1931
  }): Promise<PairingTicket>;
1898
1932
  getPairingStatus?(statusId: string): Promise<PairingStatus>;
1933
+ enableApproval?(): Promise<void>;
1934
+ listClients?(): Promise<MobileAuthorizationView[]>;
1935
+ decideClient?(requestId: string, action: "approve" | "reject" | "revoke", expectedPublicKey: string): Promise<void>;
1899
1936
  }
1900
1937
  declare class CachedPairingProvider implements PairingProvider {
1901
1938
  #private;
@@ -1907,7 +1944,7 @@ declare class CachedPairingProvider implements PairingProvider {
1907
1944
  getPairingStatus(statusId: string): Promise<PairingStatus>;
1908
1945
  }
1909
1946
  declare function buildPairingUri(relayUrl: string, code: string, machineId: string, contentKey: string): string;
1910
- declare function requestPairingUri(config: Pick<PcAgentConfig, "relayUrl" | "relayToken" | "userId">, identity: DeviceIdentity, contentKey: ContentKeyMaterial): Promise<PairingTicket>;
1947
+ declare function requestPairingUri(config: Pick<PcAgentConfig, "relayUrl" | "relayToken" | "relayAuthorization" | "userId">, identity: DeviceIdentity, contentKey: ContentKeyMaterial): Promise<PairingTicket>;
1911
1948
 
1912
1949
  declare const PEER_CHAT_TIMEOUT_MS = 120000;
1913
1950
  declare const PeerChatRequestSchema: z.ZodObject<{
@@ -1969,7 +2006,7 @@ interface RelaySocket {
1969
2006
  connect(): void;
1970
2007
  disconnect(): void;
1971
2008
  }
1972
- type RelaySocketFactory = (uri: string, options: Partial<ManagerOptions & SocketOptions>) => RelaySocket;
2009
+ type RelaySocketFactory = (uri: string, options: Partial<ManagerOptions & SocketOptions>, authorization?: RelayAuthorization) => RelaySocket;
1973
2010
 
1974
2011
  interface InitializeOptions extends Omit<PcAgentConfig, "refreshIntervalMs" | "heartbeatIntervalMs" | "exitAfterSnapshot"> {
1975
2012
  refreshIntervalMs?: number;
@@ -2054,5 +2091,5 @@ declare function codingAgentPresentation(agentId: string): CodingAgentPresentati
2054
2091
 
2055
2092
  declare const LEGACY_CLIENT_STATE_DIRECTORY: string;
2056
2093
 
2057
- export { AgentSelectionSchema, CODING_AGENT_IDS, CachedPairingProvider, ContentCipher, DataDirectoryLease, DeviceIdentitySchema, LEGACY_CLIENT_STATE_DIRECTORY, PEER_CHAT_TIMEOUT_MS, PeerChatRequestSchema, PeerChatResultSchema, SessionImageRelayUrlSchema, SessionImageUploadError, SessionImageUploader, SessionImagesConfigSchema, TimelinePageBudgetError, assertPiRuntimeSupported, buildPairingUri, codingAgentPresentation, createCodingAgentAdapter, createPersistentContentCipher, generateContentKey, initialize, loadOrCreateContentKey, parseContentKey, requestPairingUri, supportsAgentSelection };
2058
- export type { Agent, AgentSelection, AgentSelectionProvider, AgentSessionConfiguration, AgentSessionConfigureOptions, AgentSessionCreateOptions, CodingAgentAdapter, CodingAgentConfig, CodingAgentId, CodingAgentSessionCallbacks, ContentKeyMaterial, DeviceIdentity, InitializeOptions, PairingProvider, PairingTicket, PcAgentConfig, PeerChatRequest, PeerChatResult, RelayRegistrationStatus, RelaySocket, RelaySocketFactory, SelectableAgent, SessionImageUploadErrorCode, SessionImageUploaderConfig, TimelineImageProjection, TimelineReadOptions };
2094
+ export { AgentSelectionSchema, CODING_AGENT_IDS, CachedPairingProvider, ContentCipher, DataDirectoryLease, DeviceIdentitySchema, LEGACY_CLIENT_STATE_DIRECTORY, PEER_CHAT_TIMEOUT_MS, PeerChatRequestSchema, PeerChatResultSchema, SessionImageRelayUrlSchema, SessionImageUploadError, SessionImageUploader, SessionImagesConfigSchema, TimelinePageBudgetError, assertPiRuntimeSupported, buildPairingUri, codingAgentPresentation, createCodingAgentAdapter, createPersistentContentCipher, generateContentKey, initialize, loadOrCreateContentKey, parseContentKey, relayRequestToken, requestPairingUri, supportsAgentSelection };
2095
+ export type { Agent, AgentSelection, AgentSelectionProvider, AgentSessionConfiguration, AgentSessionConfigureOptions, AgentSessionCreateOptions, CodingAgentAdapter, CodingAgentConfig, CodingAgentId, CodingAgentSessionCallbacks, ContentKeyMaterial, DeviceIdentity, InitializeOptions, PairingProvider, PairingTicket, PcAgentConfig, PeerChatRequest, PeerChatResult, RelayAccessToken, RelayAuthorization, RelayRegistrationStatus, RelaySocket, RelaySocketFactory, SelectableAgent, SessionImageUploadErrorCode, SessionImageUploaderConfig, TimelineImageProjection, TimelineReadOptions };