@hachej/boring-agent 0.1.109 → 0.1.111

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 (30) hide show
  1. package/dist/{errors-CEU4iujR.d.ts → admin-DORVQfLn.d.ts} +80 -3
  2. package/dist/{chunk-GS4ADE34.js → chunk-42D6KAQV.js} +36 -12
  3. package/dist/{chunk-6OANSUEI.js → chunk-72KT6VWV.js} +59 -2
  4. package/dist/{chunk-3JFPS2O6.js → chunk-KJIEMSQP.js} +10 -1
  5. package/dist/{chunk-MVKXLMH3.js → chunk-KN72XWP7.js} +1 -1
  6. package/dist/{chunk-KDXIXVF6.js → chunk-V3H5A3BR.js} +12410 -5047
  7. package/dist/core/index.d.ts +5 -5
  8. package/dist/core/index.js +2 -1
  9. package/dist/{createHarness-AHWSC36D.js → createHarness-DOLOHA62.js} +2 -2
  10. package/dist/file-search-BUgMSKZE.d.ts +289 -0
  11. package/dist/front/index.d.ts +89 -4
  12. package/dist/front/index.js +508 -47
  13. package/dist/front/styles.css +55 -55
  14. package/dist/{harness-Ct0e4RWc.d.ts → harness-qHlMJhZo.d.ts} +1 -1
  15. package/dist/{piChatEvent-BUWIzw5l.d.ts → piChatEvent-DpE0lIb9.d.ts} +49 -17
  16. package/dist/{piChatSessionService-nvroRAVk.d.ts → piChatSessionService-CBct-hmz.d.ts} +4 -1
  17. package/dist/server/agent-host/testing/gatewayConformance.d.ts +7 -6
  18. package/dist/server/agent-host/testing/gatewayConformance.js +14 -7
  19. package/dist/server/index.d.ts +890 -56
  20. package/dist/server/index.js +73 -7
  21. package/dist/server/worker/index.js +5 -5
  22. package/dist/{lease-nASWv2tU.d.ts → share-entry-CxS6UJ_L.d.ts} +77 -179
  23. package/dist/shared/index.d.ts +118 -222
  24. package/dist/shared/index.js +17 -5
  25. package/dist/{types-B7-PN5jV.d.ts → types-DcWoQMn8.d.ts} +346 -10
  26. package/docs/AGENT_GATEWAY_V0.md +22 -2
  27. package/docs/AGENT_PACKAGES.md +15 -5
  28. package/docs/ERROR_CODES.md +14 -0
  29. package/package.json +10 -18
  30. package/dist/file-search-BGUHnW9o.d.ts +0 -87
@@ -1,4 +1,4 @@
1
- import { d as PiChatEvent, l as SessionArchiveFilter, C as ChatModelSelection, T as ThinkingLevel, m as ChatAttachmentPayload, n as QueuedUserMessage, c as PiChatSnapshot } from './piChatEvent-BUWIzw5l.js';
1
+ import { d as PiChatEvent, l as SessionArchiveFilter, O as OriginChannel, C as ChatModelSelection, T as ThinkingLevel, m as ChatAttachmentPayload, n as QueuedUserMessage, c as PiChatSnapshot } from './piChatEvent-DpE0lIb9.js';
2
2
 
3
3
  /** Placement-independent event envelope. `seq` is the only replay cursor. */
4
4
  interface AgentSessionEvent {
@@ -74,7 +74,7 @@ interface AgentSummary {
74
74
  readonly pluginIds?: readonly string[];
75
75
  readonly definition?: {
76
76
  readonly version: string;
77
- readonly digest: string;
77
+ readonly digest?: string;
78
78
  };
79
79
  }
80
80
  interface ListAgentsInput {
@@ -112,6 +112,8 @@ interface CreateAgentSessionInput {
112
112
  readonly agentTypeId: string;
113
113
  readonly requestId: string;
114
114
  readonly title?: string;
115
+ /** Trusted host-originated channel identity; browser callers normally omit it. */
116
+ readonly originChannel?: OriginChannel;
115
117
  /** Boot-only intent to resume this exact tab-owned empty session. */
116
118
  readonly resumeSessionId?: string;
117
119
  }
@@ -260,4 +262,79 @@ declare class AgentGatewayError extends Error {
260
262
  toJSON(): AgentGatewayErrorDTO;
261
263
  }
262
264
 
263
- export { type AgentGateway as A, type JsonValue as B, type ConnectAgentSessionInput as C, type DeleteAgentSessionInput as D, type RenameAgentSessionInput as E, type ResolveAgentAccess as F, type ResolveAgentAccessInput as G, type IdempotentAgentControl as I, type JsonPrimitive as J, type ListAgentsInput as L, type ReadAgentSessionStateInput as R, type VerifiedAgentScopeClaim as V, type WorkspaceScopeId as W, type AuthorizedAgentScope as a, type AgentSessionRef as b, type AgentSessionActivity as c, type AgentSendReceipt as d, AGENT_GATEWAY_ERROR_CODES as e, type AgentAccessDecision as f, type AgentAccessOperation as g, type AgentFollowUpCommand as h, AgentGatewayError as i, AgentGatewayErrorCode as j, type AgentGatewayErrorDTO as k, type AgentPromptCommand as l, type AgentScopeVerifier as m, type AgentSessionConnection as n, type AgentSessionEvent as o, type AgentSessionPage as p, type AgentSessionStateSnapshot as q, type AgentSessionSummary as r, type AgentSummary as s, type AuthSubjectId as t, type AuthorizedAgentSessionQuery as u, type CreateAgentSessionInput as v, type IdempotentAgentSend as w, type IdempotentInterruptControl as x, type IdempotentQueueClear as y, type JsonSafe as z };
265
+ declare const CREDENTIAL_ERROR_CODES: {
266
+ readonly PROVIDER_UNKNOWN: "CREDENTIAL_PROVIDER_UNKNOWN";
267
+ readonly NOT_CONFIGURED: "CREDENTIAL_NOT_CONFIGURED";
268
+ readonly DISABLED: "CREDENTIAL_DISABLED";
269
+ readonly REVOKED: "CREDENTIAL_REVOKED";
270
+ readonly FORBIDDEN: "CREDENTIAL_FORBIDDEN";
271
+ readonly WORKSPACE_MISMATCH: "CREDENTIAL_WORKSPACE_MISMATCH";
272
+ readonly CONSUMER_MISMATCH: "CREDENTIAL_CONSUMER_MISMATCH";
273
+ readonly DELIVERY_FORBIDDEN: "CREDENTIAL_DELIVERY_FORBIDDEN";
274
+ readonly AUTHORITY_INVALID: "CREDENTIAL_AUTHORITY_INVALID";
275
+ readonly SCHEMA_MISMATCH: "CREDENTIAL_SCHEMA_MISMATCH";
276
+ readonly UNREADABLE: "CREDENTIAL_UNREADABLE";
277
+ readonly BACKEND_UNAVAILABLE: "CREDENTIAL_BACKEND_UNAVAILABLE";
278
+ readonly KEK_UNAVAILABLE: "CREDENTIAL_KEK_UNAVAILABLE";
279
+ readonly LEASE_EXPIRED: "CREDENTIAL_LEASE_EXPIRED";
280
+ readonly OAUTH_STATE_INVALID: "CREDENTIAL_OAUTH_STATE_INVALID";
281
+ readonly OAUTH_REFRESH_FAILED: "CREDENTIAL_OAUTH_REFRESH_FAILED";
282
+ readonly VALIDATION_UNAUTHORIZED: "CREDENTIAL_VALIDATION_UNAUTHORIZED";
283
+ readonly VALIDATION_RATE_LIMITED: "CREDENTIAL_VALIDATION_RATE_LIMITED";
284
+ readonly VALIDATION_UNAVAILABLE: "CREDENTIAL_VALIDATION_UNAVAILABLE";
285
+ readonly VALIDATION_TIMEOUT: "CREDENTIAL_VALIDATION_TIMEOUT";
286
+ readonly VALIDATION_UNSUPPORTED: "CREDENTIAL_VALIDATION_UNSUPPORTED";
287
+ };
288
+ type CredentialErrorCode = (typeof CREDENTIAL_ERROR_CODES)[keyof typeof CREDENTIAL_ERROR_CODES];
289
+ declare class CredentialResolutionError extends Error {
290
+ readonly code: CredentialErrorCode;
291
+ readonly retryable: boolean;
292
+ constructor(code: CredentialErrorCode, message: string, options?: Readonly<{
293
+ retryable?: boolean;
294
+ }>);
295
+ }
296
+
297
+ type CredentialLifecycleStateV1 = 'active' | 'disabled' | 'revoked' | 'needs_reauth' | 'intentionally_absent' | 'instance_fallback_enabled';
298
+ /** Metadata-only HTTP contract. No secret-bearing property exists on response DTOs. */
299
+ interface OAuthRevocationReceiptV1 {
300
+ readonly localStatus: 'revoked';
301
+ /** Pending means Pi provided no verifiable upstream revocation confirmation. */
302
+ readonly upstreamStatus: 'pending' | 'confirmed';
303
+ readonly attemptedAt: string;
304
+ }
305
+ interface CredentialMetadataV1 {
306
+ readonly providerId: string;
307
+ readonly displayName: string;
308
+ readonly credentialType: string;
309
+ readonly state: CredentialLifecycleStateV1 | 'not_configured';
310
+ readonly credentialVersion?: number;
311
+ readonly maskedLastFourSuffix?: string;
312
+ readonly createdAt?: string;
313
+ readonly updatedAt?: string;
314
+ readonly oauthRevocation?: OAuthRevocationReceiptV1;
315
+ }
316
+ interface CredentialMetadataListResponseV1 {
317
+ readonly credentials: readonly CredentialMetadataV1[];
318
+ }
319
+ interface CredentialWriteRequestV1 {
320
+ readonly displayLabel?: string;
321
+ readonly fields: Readonly<Record<string, string>>;
322
+ }
323
+ type CredentialKeyLifecycleOperationV1 = 'rotate' | 'rewrap' | 'crypto-shred';
324
+ /** Metadata-only, caller-supplied-idempotency receipt; never includes key material. */
325
+ interface CredentialKeyLifecycleReceiptV1 {
326
+ readonly contractVersion: 'boring.credential-key-lifecycle-receipt.v1';
327
+ readonly operation: CredentialKeyLifecycleOperationV1;
328
+ readonly workspaceId: string;
329
+ readonly operationId: string;
330
+ readonly status: 'completed';
331
+ readonly dekGeneration?: number;
332
+ }
333
+ interface CredentialRouteErrorV1 {
334
+ readonly error: {
335
+ readonly code: CredentialErrorCode;
336
+ readonly message: string;
337
+ };
338
+ }
339
+
340
+ export { type AgentGateway as A, type CredentialLifecycleStateV1 as B, CREDENTIAL_ERROR_CODES as C, type CredentialMetadataListResponseV1 as D, type CredentialMetadataV1 as E, CredentialResolutionError as F, type CredentialRouteErrorV1 as G, type CredentialWriteRequestV1 as H, type DeleteAgentSessionInput as I, type IdempotentAgentControl as J, type IdempotentAgentSend as K, type IdempotentInterruptControl as L, type IdempotentQueueClear as M, type JsonPrimitive as N, type JsonSafe as O, type JsonValue as P, type ListAgentsInput as Q, type ReadAgentSessionStateInput as R, type RenameAgentSessionInput as S, type ResolveAgentAccess as T, type ResolveAgentAccessInput as U, type VerifiedAgentScopeClaim as V, type WorkspaceScopeId as W, type AuthorizedAgentScope as a, type AgentSessionRef as b, type AgentSessionActivity as c, type AgentSendReceipt as d, AGENT_GATEWAY_ERROR_CODES as e, type AgentAccessDecision as f, type AgentAccessOperation as g, type AgentFollowUpCommand as h, AgentGatewayError as i, AgentGatewayErrorCode as j, type AgentGatewayErrorDTO as k, type AgentPromptCommand as l, type AgentScopeVerifier as m, type AgentSessionConnection as n, type AgentSessionEvent as o, type AgentSessionPage as p, type AgentSessionStateSnapshot as q, type AgentSessionSummary as r, type AgentSummary as s, type AuthSubjectId as t, type AuthorizedAgentSessionQuery as u, type ConnectAgentSessionInput as v, type CreateAgentSessionInput as w, type CredentialErrorCode as x, type CredentialKeyLifecycleOperationV1 as y, type CredentialKeyLifecycleReceiptV1 as z };
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-7XAOVFSN.js";
7
7
  import {
8
8
  ErrorCode
9
- } from "./chunk-3JFPS2O6.js";
9
+ } from "./chunk-KJIEMSQP.js";
10
10
 
11
11
  // src/server/harness/pi-coding-agent/createHarness.ts
12
12
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -1158,13 +1158,15 @@ var PiSessionStore = class {
1158
1158
  await mkdir2(this.sessionDir, { recursive: true });
1159
1159
  const id = randomUUID3();
1160
1160
  const now = (/* @__PURE__ */ new Date()).toISOString();
1161
+ const originChannel = init?.originChannel ?? "web";
1161
1162
  const header = {
1162
1163
  type: "session",
1163
1164
  version: CURRENT_SESSION_VERSION2,
1164
1165
  id,
1165
1166
  timestamp: now,
1166
1167
  cwd: this.cwd,
1167
- boringSessionCtx: normalizeSessionCtx(ctx) ?? {}
1168
+ boringSessionCtx: normalizeSessionCtx(ctx) ?? {},
1169
+ boringOriginChannel: originChannel
1168
1170
  };
1169
1171
  const lines = [JSON.stringify(header)];
1170
1172
  if (manualTitle) {
@@ -1186,7 +1188,8 @@ var PiSessionStore = class {
1186
1188
  updatedAt: now,
1187
1189
  turnCount: 0,
1188
1190
  nativeSessionId: id,
1189
- hasAssistantReply: false
1191
+ hasAssistantReply: false,
1192
+ originChannel
1190
1193
  };
1191
1194
  }
1192
1195
  /**
@@ -1220,7 +1223,8 @@ var PiSessionStore = class {
1220
1223
  ...resolved.directNative ? {
1221
1224
  nativeSessionId: resolved.resolvedSessionId,
1222
1225
  hasAssistantReply: resolved.transcriptSummary.hasAssistantReply
1223
- } : {}
1226
+ } : {},
1227
+ originChannel: readHeaderOriginChannel(resolved.header)
1224
1228
  }, await readArchivedSessionIds(this.sessionDir));
1225
1229
  }
1226
1230
  /**
@@ -1597,7 +1601,8 @@ var PiSessionStore = class {
1597
1601
  ...directNative ? {
1598
1602
  nativeSessionId: header.id,
1599
1603
  hasAssistantReply: transcript.hasAssistantReply
1600
- } : {}
1604
+ } : {},
1605
+ originChannel: readHeaderOriginChannel(header)
1601
1606
  };
1602
1607
  const stableForCache = sessionScan.stable && sameFileSnapshot(fileStat, sessionScan.stat) && (!linked || linked.stable);
1603
1608
  if (stableForCache) {
@@ -1933,6 +1938,10 @@ function readHeaderSessionCtx(header) {
1933
1938
  if (!raw || typeof raw !== "object") return {};
1934
1939
  return normalizeSessionCtx(raw) ?? {};
1935
1940
  }
1941
+ function readHeaderOriginChannel(header) {
1942
+ const raw = header?.boringOriginChannel;
1943
+ return typeof raw === "string" && raw.length > 0 ? raw : "web";
1944
+ }
1936
1945
  function normalizeSessionCtx(ctx) {
1937
1946
  if (!ctx?.workspaceId && !ctx?.userId) return void 0;
1938
1947
  return {
@@ -2311,16 +2320,18 @@ import { SettingsManager as SettingsManager2 } from "@mariozechner/pi-coding-age
2311
2320
  function readSettingsFileIfPresent(path) {
2312
2321
  return existsSync(path) ? readFileSync2(path, "utf-8") : void 0;
2313
2322
  }
2314
- function mergeInjectedProjectPackages(settingsJson, piPackages, includePackage) {
2323
+ function mergeInjectedProjectPackages(settingsJson, piPackages, includePackage, includeConfiguredPackages = true) {
2315
2324
  const settings = settingsJson ? JSON.parse(settingsJson) : {};
2316
- const configuredPackages = Array.isArray(settings.packages) ? settings.packages : [];
2325
+ const configuredPackages = includeConfiguredPackages && Array.isArray(settings.packages) ? settings.packages : [];
2317
2326
  return JSON.stringify({
2318
2327
  ...settings,
2319
2328
  packages: mergePiPackageSources(configuredPackages, piPackages).filter((source) => includePackage?.(source) ?? true)
2320
2329
  });
2321
2330
  }
2322
2331
  function createResourceSettingsManager(cwd, agentDir, piPackages, options = {}) {
2323
- if (piPackages.length === 0 && !options.includePackage) return SettingsManager2.create(cwd, agentDir);
2332
+ if (piPackages.length === 0 && !options.includePackage && options.includeConfiguredPackages !== false) {
2333
+ return SettingsManager2.create(cwd, agentDir);
2334
+ }
2324
2335
  const globalSettingsPath = join3(agentDir, "settings.json");
2325
2336
  const projectSettingsPath = join3(cwd, ".pi", "settings.json");
2326
2337
  let globalSettingsOverrideJson;
@@ -2328,12 +2339,22 @@ function createResourceSettingsManager(cwd, agentDir, piPackages, options = {})
2328
2339
  const storage = {
2329
2340
  withLock(scope, fn) {
2330
2341
  if (scope === "global") {
2331
- const current2 = globalSettingsOverrideJson ?? mergeInjectedProjectPackages(readSettingsFileIfPresent(globalSettingsPath), [], options.includePackage);
2342
+ const current2 = globalSettingsOverrideJson ?? mergeInjectedProjectPackages(
2343
+ readSettingsFileIfPresent(globalSettingsPath),
2344
+ [],
2345
+ options.includePackage,
2346
+ options.includeConfiguredPackages
2347
+ );
2332
2348
  const next2 = fn(current2);
2333
2349
  if (next2 !== void 0) globalSettingsOverrideJson = next2;
2334
2350
  return;
2335
2351
  }
2336
- const current = projectSettingsOverrideJson ?? mergeInjectedProjectPackages(readSettingsFileIfPresent(projectSettingsPath), piPackages, options.includePackage);
2352
+ const current = projectSettingsOverrideJson ?? mergeInjectedProjectPackages(
2353
+ readSettingsFileIfPresent(projectSettingsPath),
2354
+ piPackages,
2355
+ options.includePackage,
2356
+ options.includeConfiguredPackages
2357
+ );
2337
2358
  const next = fn(current);
2338
2359
  if (next !== void 0) projectSettingsOverrideJson = next;
2339
2360
  }
@@ -2621,7 +2642,9 @@ function createPiCodingAgentHarness(opts) {
2621
2642
  };
2622
2643
  }
2623
2644
  async function createPiSession(sessionId, sessionCtx, input, ctx) {
2624
- const { modelRuntime } = await createConfiguredModelRuntime();
2645
+ const { modelRuntime } = await createConfiguredModelRuntime(
2646
+ pi.credentialStore ? { credentials: pi.credentialStore } : void 0
2647
+ );
2625
2648
  const resolvedModel = resolveRequestedModel(modelRuntime, input, { strict: pi.strictModelResolution });
2626
2649
  const model = resolvedModel ?? resolveDefaultModel(modelRuntime, pi.defaultModel, pi.strictModelResolution);
2627
2650
  const savedPiFile = await sessionStore.loadPiSessionFile(sessionCtx, sessionId);
@@ -2656,7 +2679,8 @@ function createPiCodingAgentHarness(opts) {
2656
2679
  const settingsManager = createResourceSettingsManager(
2657
2680
  opts.cwd,
2658
2681
  agentDir,
2659
- effectivePackages
2682
+ effectivePackages,
2683
+ { includeConfiguredPackages: pi.noAmbientPackages !== true }
2660
2684
  );
2661
2685
  const resourceLoader = new DefaultResourceLoader({
2662
2686
  cwd: opts.cwd,
@@ -6,7 +6,7 @@ import {
6
6
  AgentDefinitionErrorCode,
7
7
  AgentDeploymentErrorCode,
8
8
  ErrorCode
9
- } from "./chunk-3JFPS2O6.js";
9
+ } from "./chunk-KJIEMSQP.js";
10
10
 
11
11
  // src/shared/skill-resource.ts
12
12
  var AGENT_RESOURCES_FILESYSTEM_ID = "agent_resources";
@@ -39,6 +39,32 @@ function isReadonlyFilesystemMutationError(value) {
39
39
  return candidate.code === READONLY_FILESYSTEM_MUTATION_CODE && candidate.statusCode === 403 && typeof candidate.filesystem === "string" && RUNTIME_FILESYSTEM_CAPABILITIES.includes(candidate.operation);
40
40
  }
41
41
 
42
+ // src/shared/channel.ts
43
+ var descriptors = [
44
+ {
45
+ id: "web",
46
+ label: "Web",
47
+ icon: "globe",
48
+ sessionsReadOnlyInWorkspace: false,
49
+ dialect: "passthrough",
50
+ canOriginateIdentity: true
51
+ },
52
+ {
53
+ id: "whatsapp",
54
+ label: "WhatsApp",
55
+ icon: "message-circle",
56
+ sessionsReadOnlyInWorkspace: true,
57
+ dialect: "whatsapp/markdown",
58
+ canOriginateIdentity: true
59
+ }
60
+ ];
61
+ var CHANNEL_DESCRIPTORS = new Map(
62
+ descriptors.map((descriptor) => [descriptor.id, Object.freeze(descriptor)])
63
+ );
64
+ function channelDescriptor(originChannel = "web") {
65
+ return CHANNEL_DESCRIPTORS.get(originChannel);
66
+ }
67
+
42
68
  // src/shared/config-schema.ts
43
69
  import { z } from "zod";
44
70
  var RuntimeModeSchema = z.enum(["direct", "local", "blaxel", "vercel-sandbox"]);
@@ -728,7 +754,12 @@ var CREDENTIAL_ERROR_CODES = {
728
754
  KEK_UNAVAILABLE: "CREDENTIAL_KEK_UNAVAILABLE",
729
755
  LEASE_EXPIRED: "CREDENTIAL_LEASE_EXPIRED",
730
756
  OAUTH_STATE_INVALID: "CREDENTIAL_OAUTH_STATE_INVALID",
731
- OAUTH_REFRESH_FAILED: "CREDENTIAL_OAUTH_REFRESH_FAILED"
757
+ OAUTH_REFRESH_FAILED: "CREDENTIAL_OAUTH_REFRESH_FAILED",
758
+ VALIDATION_UNAUTHORIZED: "CREDENTIAL_VALIDATION_UNAUTHORIZED",
759
+ VALIDATION_RATE_LIMITED: "CREDENTIAL_VALIDATION_RATE_LIMITED",
760
+ VALIDATION_UNAVAILABLE: "CREDENTIAL_VALIDATION_UNAVAILABLE",
761
+ VALIDATION_TIMEOUT: "CREDENTIAL_VALIDATION_TIMEOUT",
762
+ VALIDATION_UNSUPPORTED: "CREDENTIAL_VALIDATION_UNSUPPORTED"
732
763
  };
733
764
  var CredentialResolutionError = class extends Error {
734
765
  code;
@@ -741,6 +772,26 @@ var CredentialResolutionError = class extends Error {
741
772
  }
742
773
  };
743
774
 
775
+ // src/shared/credentials/custody.ts
776
+ function workspaceCredentialCustodyScopeV1(workspaceId) {
777
+ return assertCredentialCustodyScopeV1({ workspaceId, subject: { kind: "workspace" } });
778
+ }
779
+ function userCredentialCustodyScopeV1(workspaceId, userId) {
780
+ return assertCredentialCustodyScopeV1({ workspaceId, subject: { kind: "user", userId } });
781
+ }
782
+ function assertCredentialCustodyScopeV1(scope) {
783
+ if (!scope || typeof scope.workspaceId !== "string" || scope.workspaceId.length === 0 || !scope.subject || scope.subject.kind !== "workspace" && scope.subject.kind !== "user" || scope.subject.kind === "user" && (typeof scope.subject.userId !== "string" || scope.subject.userId.length === 0)) {
784
+ throw new CredentialResolutionError(CREDENTIAL_ERROR_CODES.SCHEMA_MISMATCH, "Invalid credential custody scope");
785
+ }
786
+ return Object.freeze({
787
+ workspaceId: scope.workspaceId,
788
+ subject: scope.subject.kind === "workspace" ? Object.freeze({ kind: "workspace" }) : Object.freeze({ kind: "user", userId: scope.subject.userId })
789
+ });
790
+ }
791
+ function credentialCustodySubjectKeyV1(subject) {
792
+ return subject.kind === "workspace" ? "workspace" : encodeURIComponent(subject.userId);
793
+ }
794
+
744
795
  // src/shared/credentials/bindings.ts
745
796
  var CREDENTIAL_ID_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/;
746
797
  var MAX_BINDING_TEXT_LENGTH_V1 = 256;
@@ -1209,6 +1260,8 @@ export {
1209
1260
  RUNTIME_FILESYSTEM_CAPABILITIES,
1210
1261
  ReadonlyFilesystemMutationError,
1211
1262
  isReadonlyFilesystemMutationError,
1263
+ CHANNEL_DESCRIPTORS,
1264
+ channelDescriptor,
1212
1265
  RuntimeModeSchema,
1213
1266
  ConfigSchema,
1214
1267
  EnvSchema,
@@ -1261,6 +1314,10 @@ export {
1261
1314
  resolveShareEntry,
1262
1315
  CREDENTIAL_ERROR_CODES,
1263
1316
  CredentialResolutionError,
1317
+ workspaceCredentialCustodyScopeV1,
1318
+ userCredentialCustodyScopeV1,
1319
+ assertCredentialCustodyScopeV1,
1320
+ credentialCustodySubjectKeyV1,
1264
1321
  providerCredentialFieldsV1,
1265
1322
  createCredentialConsumerBindingRegistryV1,
1266
1323
  WORKSPACE_KEK_PROVIDER_VERSION,
@@ -138,9 +138,18 @@ var ErrorCode = z.enum([
138
138
  // Lane W same-workspace share deep-link (AR1-003)
139
139
  "AR1_SHARE_NOT_FOUND",
140
140
  "AR1_SHARE_TOMBSTONED",
141
- // Event stream durability
141
+ // Event stream durability / external channels
142
142
  "EVENT_STORE_OPEN_FAILED",
143
143
  "DURABLE_STREAM_UNAVAILABLE",
144
+ "CHANNEL_DURABLE_STREAM_REQUIRED",
145
+ "CHANNEL_INBOUND_ACCEPTED",
146
+ "CHANNEL_UNKNOWN_BINDING",
147
+ "CHANNEL_INBOUND_PARKED",
148
+ "CHANNEL_OUTBOUND_PARKED",
149
+ "CHANNEL_TURN_STALLED",
150
+ "CHANNEL_BINDING_BUSY",
151
+ "CHANNEL_BINDING_REVOKED",
152
+ "SESSION_CREATE_TIMEOUT",
144
153
  // Internal
145
154
  "ERR_NOT_IMPLEMENTED_UNTIL_T1",
146
155
  "INTERNAL_ERROR"
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ErrorCode
3
- } from "./chunk-3JFPS2O6.js";
3
+ } from "./chunk-KJIEMSQP.js";
4
4
 
5
5
  // src/shared/tool-ui.ts
6
6
  function isRecord(value) {