@tangle-network/sdk-provider-claude-code 0.6.2 → 0.6.4

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 (2) hide show
  1. package/dist/index.mjs +168 -4
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -178,6 +178,12 @@ function managedModelProxyUrl(input) {
178
178
  const runtimeHome = input.runtimeHome?.trim();
179
179
  return proxiedModelUrl(binding.baseUrl, input.upstream, { ...runtimeHome ? { runtimeHome } : {} });
180
180
  }
181
+ //#endregion
182
+ //#region ../runtime-contracts/dist/declared-secrets.js
183
+ /** Bound values stay at the proxy. Declarations carry metadata only and are
184
+ * revalidated at every rebuild; an unbound name keeps box delivery unless the store's policy binds it.
185
+ * A declaration may bind several hosts: one credential, one slot and placeholder, many vendor hosts. */
186
+ const MAX_SECRET_VALUE_LENGTH = 65536;
181
187
  new Set([
182
188
  ...Object.keys(MODEL_PROXY_TOKENS),
183
189
  "TANGLE_API_KEY",
@@ -238,6 +244,48 @@ const HARNESS_WARM_TRANSPORT_ENV = {
238
244
  }
239
245
  };
240
246
  //#endregion
247
+ //#region ../runtime-contracts/dist/model-key-refresh.js
248
+ const batchCredentialOwner = {
249
+ allocationId: z.uuid(),
250
+ ownerId: z.string().min(1).max(256)
251
+ };
252
+ z.strictObject({
253
+ ...batchCredentialOwner,
254
+ childKeyId: z.string().min(1).max(200).optional(),
255
+ keyExpiresAt: z.iso.datetime({ offset: true }).optional()
256
+ });
257
+ const batchCredentialIdentity = {
258
+ ...batchCredentialOwner,
259
+ expiresAt: z.iso.datetime({ offset: true })
260
+ };
261
+ z.discriminatedUnion("operation", [
262
+ z.strictObject({
263
+ operation: z.literal("batch-allocate"),
264
+ ...batchCredentialIdentity,
265
+ admissionDeadlineMs: z.number().int().positive(),
266
+ sourceKey: z.string().min(1).max(4096)
267
+ }),
268
+ z.strictObject({
269
+ operation: z.literal("batch-rotate"),
270
+ ...batchCredentialIdentity
271
+ }),
272
+ z.strictObject({
273
+ operation: z.literal("batch-release"),
274
+ ...batchCredentialIdentity,
275
+ childKeyId: z.string().min(1).max(200).optional()
276
+ })
277
+ ]);
278
+ z.union([z.object({
279
+ refreshed: z.literal(true),
280
+ apiKey: z.string().min(1),
281
+ keyId: z.string().min(1),
282
+ baseUrl: z.string().url(),
283
+ expiresAt: z.iso.datetime({ offset: true })
284
+ }), z.object({
285
+ refreshed: z.literal(false),
286
+ reason: z.string().min(1)
287
+ })]);
288
+ //#endregion
241
289
  //#region ../runtime-contracts/dist/proxy-secret-materialization.js
242
290
  const syntheticHeader = {
243
291
  alg: "HS256",
@@ -255,16 +303,24 @@ function isSyntheticPlaceholder(material) {
255
303
  const prefix = placeholderPrefix(material.slot, material.grant.placeholderFormat, material.issuerExpiresAt);
256
304
  return material.placeholder.startsWith(prefix) && /^[A-Za-z0-9_-]{43}$/.test(material.placeholder.slice(prefix.length));
257
305
  }
258
- z.array(z.strictObject({
306
+ z.array(z.preprocess((input) => {
307
+ if (input && typeof input === "object" && "issuerExpiresAt" in input && (!("executionExpiresAt" in input) || input.executionExpiresAt === void 0) && (!("native" in input) || input.native === void 0)) return {
308
+ ...input,
309
+ executionExpiresAt: input.issuerExpiresAt
310
+ };
311
+ return input;
312
+ }, z.strictObject({
259
313
  binding: ProxySecretBindingSchema,
260
314
  grant: ProxySecretGrantSchema,
261
315
  placeholder: z.string().min(1),
262
316
  slot: z.string().refine(isDeclaredSecretSlotEnvVar),
263
- issuerExpiresAt: z.iso.datetime()
264
- })).superRefine((materials, ctx) => {
317
+ issuerExpiresAt: z.iso.datetime(),
318
+ executionExpiresAt: z.iso.datetime(),
319
+ native: z.unknown().optional()
320
+ }))).superRefine((materials, ctx) => {
265
321
  const bindings = ProxySecretsSchema.safeParse(materials.map((m) => m.binding));
266
322
  const unique = (values) => new Set(values).size === values.length;
267
- if (!bindings.success || !unique(materials.map((m) => m.slot)) || !unique(materials.map((m) => m.placeholder)) || !unique(materials.map((m) => m.grant.grantId)) || new Set(materials.map((m) => m.grant.epoch)).size > 1 || new Set(materials.map((m) => m.grant.sandboxId)).size > 1 || materials.some((material) => !isSyntheticPlaceholder(material)) || materials.some(({ binding, grant, issuerExpiresAt }) => !isProxySecretScopeAttenuation(binding, grant.scope) || !proxySecretPresentationsEqual(binding.presentation, grant.presentation) || (binding.placeholderFormat ?? "opaque") !== grant.placeholderFormat || Date.parse(grant.expiresAt) > Date.parse(issuerExpiresAt))) ctx.addIssue({
323
+ if (!bindings.success || !unique(materials.map((m) => m.slot)) || !unique(materials.map((m) => m.placeholder)) || !unique(materials.map((m) => m.grant.grantId)) || new Set(materials.map((m) => m.grant.epoch)).size > 1 || new Set(materials.map((m) => m.grant.sandboxId)).size > 1 || materials.some((material) => !isSyntheticPlaceholder(material)) || materials.some(({ binding, grant, issuerExpiresAt, executionExpiresAt }) => !isProxySecretScopeAttenuation(binding, grant.scope) || !proxySecretPresentationsEqual(binding.presentation, grant.presentation) || (binding.placeholderFormat ?? "opaque") !== grant.placeholderFormat || Date.parse(grant.expiresAt) > Date.parse(executionExpiresAt) || Date.parse(executionExpiresAt) > Date.parse(issuerExpiresAt))) ctx.addIssue({
268
324
  code: "custom",
269
325
  message: "Invalid proxy secret materialization"
270
326
  });
@@ -274,6 +330,114 @@ ProxySecretUpdateControlsSchema.extend({
274
330
  proxySecretGrants: ProxySecretReceiptSchema.options[0].shape.bindings,
275
331
  expectedProxySecretGeneration: ProxySecretUpdateControlsSchema.shape.expectedProxySecretGeneration.unwrap()
276
332
  }).strict().refine((body) => new Set(body.proxySecretGrants.map((b) => b.envName)).size === body.proxySecretGrants.length);
333
+ const sourceBindingSchema = ProxySecretReceiptSchema.options[0].shape.bindings.element;
334
+ const sourceRevisionSchema = z.iso.datetime();
335
+ const sourceLeaseTokenSchema = z.uuid();
336
+ const sourceAuthority = {
337
+ binding: sourceBindingSchema,
338
+ issuerExpiresAt: z.iso.datetime()
339
+ };
340
+ z.discriminatedUnion("operation", [
341
+ z.strictObject({
342
+ operation: z.literal("read"),
343
+ ...sourceAuthority,
344
+ rekey: z.literal(true).optional()
345
+ }),
346
+ z.strictObject({
347
+ operation: z.literal("lease"),
348
+ ...sourceAuthority,
349
+ expectedUpdatedAt: sourceRevisionSchema,
350
+ leaseExpiresAt: z.iso.datetime(),
351
+ leaseToken: sourceLeaseTokenSchema.optional()
352
+ }),
353
+ z.strictObject({
354
+ operation: z.literal("commit"),
355
+ ...sourceAuthority,
356
+ expectedUpdatedAt: sourceRevisionSchema,
357
+ leaseToken: sourceLeaseTokenSchema,
358
+ value: z.string().min(1).max(MAX_SECRET_VALUE_LENGTH)
359
+ }),
360
+ z.strictObject({
361
+ operation: z.literal("release"),
362
+ ...sourceAuthority,
363
+ leaseToken: sourceLeaseTokenSchema
364
+ })
365
+ ]);
366
+ const sourceMetadataSchema = z.strictObject({
367
+ secretId: z.string().min(1),
368
+ key: ProxySecretBindingSchema.shape.secretRef.shape.key,
369
+ updatedAt: sourceRevisionSchema
370
+ });
371
+ const sourceSnapshotSchema = sourceMetadataSchema.extend({ value: z.string().min(1).max(MAX_SECRET_VALUE_LENGTH) });
372
+ z.discriminatedUnion("operation", [
373
+ z.strictObject({
374
+ operation: z.literal("read"),
375
+ source: sourceSnapshotSchema,
376
+ binding: sourceBindingSchema,
377
+ refreshExpiresAt: z.iso.datetime()
378
+ }),
379
+ z.strictObject({
380
+ operation: z.literal("lease"),
381
+ source: sourceSnapshotSchema,
382
+ leaseToken: sourceLeaseTokenSchema,
383
+ leaseExpiresAt: z.iso.datetime(),
384
+ phase: z.enum([
385
+ "leased",
386
+ "started",
387
+ "replay"
388
+ ]).default("leased")
389
+ }),
390
+ z.strictObject({
391
+ operation: z.literal("commit"),
392
+ source: sourceMetadataSchema
393
+ }),
394
+ z.strictObject({
395
+ operation: z.literal("release"),
396
+ released: z.literal(true)
397
+ })
398
+ ]);
399
+ const nativeCredentialProtocolSchema = z.enum([
400
+ "legacy",
401
+ "canonical",
402
+ "unselected"
403
+ ]);
404
+ z.strictObject({
405
+ nativeCredentialProtocol: nativeCredentialProtocolSchema,
406
+ priorExposure: z.boolean(),
407
+ containerId: z.string().min(1),
408
+ expectedProxySecretGeneration: ProxySecretUpdateControlsSchema.shape.expectedProxySecretGeneration,
409
+ authorityExpiresAt: z.iso.datetime().optional()
410
+ });
411
+ ownPropertyRecordSchema(z.strictObject({
412
+ revision: ProxySecretGrantSchema.shape.identity.shape.revision,
413
+ value: z.string().min(1).max(MAX_SECRET_VALUE_LENGTH),
414
+ refresh: z.strictObject({
415
+ revision: sourceRevisionSchema,
416
+ leaseToken: sourceLeaseTokenSchema
417
+ }).optional()
418
+ }));
419
+ z.strictObject({
420
+ grant: ProxySecretGrantSchema,
421
+ value: z.string().min(1).max(MAX_SECRET_VALUE_LENGTH),
422
+ expectedUpdatedAt: sourceRevisionSchema.optional(),
423
+ replayOnly: z.boolean().optional(),
424
+ leaseExpiresAt: z.iso.datetime()
425
+ });
426
+ z.discriminatedUnion("status", [
427
+ z.strictObject({
428
+ status: z.literal("refreshed"),
429
+ value: z.string().min(1).max(MAX_SECRET_VALUE_LENGTH),
430
+ sourceExpiresAt: z.iso.datetime().optional()
431
+ }),
432
+ z.strictObject({
433
+ status: z.literal("nonrefreshable"),
434
+ reason: z.string().min(1)
435
+ }),
436
+ z.strictObject({
437
+ status: z.literal("refused"),
438
+ reason: z.string().min(1)
439
+ })
440
+ ]);
277
441
  //#endregion
278
442
  //#region ../runtime-contracts/dist/runtime-environment.js
279
443
  const SAFE_ENV_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sdk-provider-claude-code",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -17,9 +17,9 @@
17
17
  "dependencies": {
18
18
  "@modelcontextprotocol/sdk": "^1.32.2",
19
19
  "@tangle-network/agent-interface": "^5.10.20",
20
- "@tangle-network/agent-profile-materialize": "1.1.56",
20
+ "@tangle-network/agent-profile-materialize": "1.1.57",
21
21
  "@tangle-network/sdk-cli-runner": "0.3.9",
22
- "@tangle-network/sdk-provider-cli-base": "0.13.19",
22
+ "@tangle-network/sdk-provider-cli-base": "0.13.21",
23
23
  "@tangle-network/sdk-session-persistence": "0.7.5",
24
24
  "zod": "4.6.7"
25
25
  },
@@ -35,8 +35,8 @@
35
35
  "registry": "https://registry.npmjs.org"
36
36
  },
37
37
  "tangleRelease": {
38
- "sourceSha": "7f35269c55c7dbf9cc12ef1fd210bd1f9f8eab58",
39
- "mergedAt": "2026-11-06T21:08:17-08:00"
38
+ "sourceSha": "11ec864cf47315566ae4b07a883e1c8637783d85",
39
+ "mergedAt": "2026-11-07T01:24:01-08:00"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsdown",