@pstdio/pocketcoder-sdk 0.9.0 → 0.10.0

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.
package/dist/index.js CHANGED
@@ -1427,7 +1427,8 @@ z.object({ name: SecretNameSchema });
1427
1427
  const issuerUrl = z.url().refine((value) => {
1428
1428
  if (!URL.canParse(value)) return false;
1429
1429
  const url = new URL(value);
1430
- return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
1430
+ const clusterLocal = url.protocol === "http:" && url.hostname.endsWith(".svc.cluster.local");
1431
+ return (url.protocol === "https:" || clusterLocal) && !url.username && !url.password && !url.search && !url.hash;
1431
1432
  });
1432
1433
  const IssuerConfigSchema = z.strictObject({
1433
1434
  url: issuerUrl,
@@ -2514,7 +2515,8 @@ const TerminalSessionPageSchema = CursorPageSchema(TerminalSessionSchema);
2514
2515
  //#region ../contracts/src/protocol/protocol-credentials.ts
2515
2516
  const WorkspaceCredentialSchema = z.object({
2516
2517
  lease_id: z.uuid(),
2517
- path: z.string().regex(/^\/run\/pocketcoder\/secrets\/leases\/[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/),
2518
+ path: z.string().regex(/^\/run\/pocketcoder\/secrets\/leases\/(?:sessions\/[0-9a-f-]{36}\/)?[A-Za-z0-9][A-Za-z0-9_.%-]{0,127}$/),
2519
+ session_id: z.uuid().optional(),
2518
2520
  credential: z.string().min(1).max(SOURCE_CREDENTIAL_MAX_BYTES).refine((value) => !value.includes("\0")),
2519
2521
  expires_at: z.iso.datetime(),
2520
2522
  purpose: z.enum(["setup-issuer", "runtime-issuer"])
@@ -2532,6 +2534,9 @@ const CredentialInstalledPayload = z.object({
2532
2534
  previous_lease_id: z.uuid(),
2533
2535
  lease_id: z.uuid()
2534
2536
  });
2537
+ const CredentialInstallPayload = z.object({ credentials: z.array(WorkspaceCredentialSchema).min(1).max(64) });
2538
+ const CredentialRemovePayload = z.object({ session_id: z.uuid() });
2539
+ const CredentialInstallAckPayload = z.object({ lease_ids: z.array(z.uuid()).min(1).max(64) });
2535
2540
  //#endregion
2536
2541
  //#region ../contracts/src/protocol/protocol-stream.ts
2537
2542
  const ProxyStreamStartPayload = z.object({
@@ -2621,7 +2626,8 @@ const EnvelopeBase = z.object({
2621
2626
  z.literal(11),
2622
2627
  z.literal(12),
2623
2628
  z.literal(13),
2624
- z.literal(14)
2629
+ z.literal(14),
2630
+ z.literal(15)
2625
2631
  ]),
2626
2632
  workspace_id: z.uuid(),
2627
2633
  connection_id: z.uuid(),
@@ -2760,6 +2766,10 @@ z.discriminatedUnion("type", [
2760
2766
  type: z.literal("credential_installed"),
2761
2767
  payload: CredentialInstalledPayload
2762
2768
  }),
2769
+ EnvelopeBase.extend({
2770
+ type: z.literal("credential_install_ack"),
2771
+ payload: CredentialInstallAckPayload
2772
+ }),
2763
2773
  EnvelopeBase.extend({
2764
2774
  type: z.literal("setup_complete"),
2765
2775
  payload: z.object({ request_id: z.uuid() })
@@ -2939,6 +2949,14 @@ z.discriminatedUnion("type", [
2939
2949
  type: z.literal("credential_installed_ack"),
2940
2950
  payload: CredentialInstalledPayload
2941
2951
  }),
2952
+ EnvelopeBase.extend({
2953
+ type: z.literal("credential_install"),
2954
+ payload: CredentialInstallPayload
2955
+ }),
2956
+ EnvelopeBase.extend({
2957
+ type: z.literal("credential_remove"),
2958
+ payload: CredentialRemovePayload
2959
+ }),
2942
2960
  EnvelopeBase.extend({
2943
2961
  type: z.literal("setup_complete_ack"),
2944
2962
  payload: z.object({ request_id: z.uuid() })
@@ -3243,7 +3261,11 @@ const ExecutionProfileSchema = z.strictObject({
3243
3261
  isolationScopeId: z.uuid(),
3244
3262
  budgetScopeIds: z.array(z.uuid()).min(1).max(1e3).refine((items) => new Set(items).size === items.length, "Values must be unique"),
3245
3263
  templateDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),
3246
- credentialBindingId: z.uuid().nullable()
3264
+ credentialBindingId: z.uuid().nullable(),
3265
+ credentialPlacement: z.enum(["exclusive", "shared"]).optional()
3266
+ }).refine((profile) => profile.credentialBindingId !== null || profile.credentialPlacement === void 0, {
3267
+ message: "Only a credentialed profile can choose its credential placement",
3268
+ path: ["credentialPlacement"]
3247
3269
  });
3248
3270
  const SessionCreateSchema = z.strictObject({
3249
3271
  sessionId: z.uuid(),
@@ -3457,7 +3479,7 @@ const ManagedExportPageSchema = z.strictObject({
3457
3479
  //#region ../contracts/src/sessions/placement.ts
3458
3480
  function managedPlacement(principalId, sessionId, input) {
3459
3481
  const profile = ExecutionProfileSchema.parse(input);
3460
- const mode = profile.credentialBindingId === null ? "shared" : "exclusive";
3482
+ const mode = profile.credentialBindingId === null || profile.credentialPlacement === "shared" ? "shared" : "exclusive";
3461
3483
  return {
3462
3484
  mode,
3463
3485
  key: digestOf({
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type:library"
7
7
  ]
8
8
  },
9
- "version": "0.9.0",
9
+ "version": "0.10.0",
10
10
  "private": false,
11
11
  "description": "Runtime-validated TypeScript client for the PocketCoder control plane.",
12
12
  "type": "module",