@noodleseed/one 0.149.0 → 0.151.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.
Files changed (61) hide show
  1. package/dist/commands/assistant-ops.d.ts.map +1 -1
  2. package/dist/commands/assistant-ops.js +4 -1
  3. package/dist/commands/assistant-ops.js.map +1 -1
  4. package/dist/commands/assistant-sponsorship-ops.d.ts +3 -0
  5. package/dist/commands/assistant-sponsorship-ops.d.ts.map +1 -0
  6. package/dist/commands/assistant-sponsorship-ops.js +170 -0
  7. package/dist/commands/assistant-sponsorship-ops.js.map +1 -0
  8. package/dist/commands/assistant-surface-ops.d.ts +3 -0
  9. package/dist/commands/assistant-surface-ops.d.ts.map +1 -1
  10. package/dist/commands/assistant-surface-ops.js +9 -2
  11. package/dist/commands/assistant-surface-ops.js.map +1 -1
  12. package/node_modules/@noodle-borg/admission-limits/dist/counter-store.d.ts +11 -0
  13. package/node_modules/@noodle-borg/admission-limits/dist/envelope.js +12 -6
  14. package/node_modules/@noodle-borg/admission-limits/dist/in-memory-counter-store.d.ts +3 -2
  15. package/node_modules/@noodle-borg/admission-limits/dist/in-memory-counter-store.js +22 -0
  16. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +1 -1
  17. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +2 -2
  18. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  19. package/node_modules/@noodle-borg/assistant-gateway/dist/app-tool-call.d.ts +42 -0
  20. package/node_modules/@noodle-borg/assistant-gateway/dist/app-tool-call.js +48 -0
  21. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-configuration.d.ts +2 -2
  22. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-configuration.js +17 -3
  23. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-context.d.ts +13 -1
  24. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-context.js +53 -0
  25. package/node_modules/@noodle-borg/assistant-gateway/dist/embed-operator-view.d.ts +8 -0
  26. package/node_modules/@noodle-borg/assistant-gateway/dist/embed-operator-view.js +9 -1
  27. package/node_modules/@noodle-borg/assistant-gateway/dist/embed-store.d.ts +11 -1
  28. package/node_modules/@noodle-borg/assistant-gateway/dist/embed-store.js +2 -0
  29. package/node_modules/@noodle-borg/assistant-gateway/dist/in-memory-embed-store.js +6 -0
  30. package/node_modules/@noodle-borg/assistant-gateway/dist/model-error.js +6 -0
  31. package/node_modules/@noodle-borg/assistant-gateway/dist/model-request.d.ts +11 -0
  32. package/node_modules/@noodle-borg/assistant-gateway/dist/model-request.js +22 -1
  33. package/node_modules/@noodle-borg/assistant-gateway/dist/portable.d.ts +1 -0
  34. package/node_modules/@noodle-borg/assistant-gateway/dist/portable.js +1 -0
  35. package/node_modules/@noodle-borg/assistant-gateway/dist/surface-budget.d.ts +1 -1
  36. package/node_modules/@noodle-borg/assistant-gateway/dist/surface-budget.js +10 -0
  37. package/node_modules/@noodle-borg/assistant-gateway/package.json +1 -1
  38. package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts +31 -3
  39. package/node_modules/@noodle-borg/authoring/dist/assistant.js +3 -0
  40. package/node_modules/@noodle-borg/cli-catalog/dist/catalog-data-assistant.js +108 -0
  41. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +12 -0
  42. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +8 -3
  43. package/node_modules/@noodle-borg/module/dist/index.d.ts +1 -0
  44. package/node_modules/@noodle-borg/module/dist/index.js +1 -0
  45. package/node_modules/@noodle-borg/module/dist/logger.d.ts +15 -0
  46. package/node_modules/@noodle-borg/module/dist/logger.js +16 -0
  47. package/node_modules/@noodle-borg/observability/dist/assistant-app-tool-usage.js +47 -0
  48. package/node_modules/@noodle-borg/observability/dist/index.js +1 -0
  49. package/node_modules/@noodle-borg/service/dist/invocation-context.js +1 -53
  50. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-resolution.js +1 -2
  51. package/node_modules/@noodle-borg/service/dist/routes/assistant-public-configuration.js +1 -1
  52. package/node_modules/@noodle-borg/service/dist/routes/assistant-public-session.js +1 -1
  53. package/node_modules/@noodle-borg/service/dist/routes/assistant-suggestions.js +1 -2
  54. package/node_modules/@noodle-borg/service/dist/routes/assistant.js +63 -44
  55. package/node_modules/@noodle-borg/service/package.json +1 -1
  56. package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts +1 -0
  57. package/node_modules/@noodle-borg/wire-contracts/dist/index.js +1 -0
  58. package/node_modules/@noodle-borg/wire-contracts/dist/managed-assistant-sponsorship.d.ts +297 -0
  59. package/node_modules/@noodle-borg/wire-contracts/dist/managed-assistant-sponsorship.js +94 -0
  60. package/node_modules/@noodleseed/assistant/package.json +1 -1
  61. package/package.json +2 -2
@@ -1,56 +1,4 @@
1
- import { resolveInvocationContext, toolTouchesDelegatedAuth, } from '@noodle-borg/assistant-gateway/portable';
2
- import { executeAmbientContext, } from '@noodle-borg/runtime';
3
- /** Resolve one immutable snapshot, including a schema-validated read-only ambient provider. */
4
- export async function resolveInvocationContextSnapshot(input) {
5
- const callerPreference = {
6
- ...(input.caller?.locale ? { locale: input.caller.locale } : {}),
7
- ...(input.caller?.timeZone ? { timeZone: input.caller.timeZone } : {}),
8
- ...(input.applicationPreference ?? {}),
9
- };
10
- const clientHint = {
11
- ...(input.clientLocationHint?.timeZone === undefined
12
- ? {}
13
- : { timeZone: input.clientLocationHint.timeZone }),
14
- ...(input.clientHint ?? {}),
15
- };
16
- const temporal = resolveInvocationContext({
17
- instant: input.instant,
18
- ...(Object.keys(callerPreference).length > 0
19
- ? { applicationPreference: callerPreference }
20
- : {}),
21
- ...(Object.keys(clientHint).length === 0 ? {} : { clientHint }),
22
- ...(input.artifact.server.context?.defaults
23
- ? { defaults: input.artifact.server.context.defaults }
24
- : {}),
25
- });
26
- const context = {
27
- ...temporal,
28
- ...(input.clientLocationHint === undefined
29
- ? {}
30
- : { location: { ...input.clientLocationHint, source: 'client-hint' } }),
31
- };
32
- const ambient = input.artifact.server.context?.ambient;
33
- if (!ambient)
34
- return context;
35
- // An anonymous principal can never satisfy a delegated-auth fulfilment: the broker exchange
36
- // is guaranteed to fail, so skip the doomed round trip instead of paying it every turn.
37
- if (input.caller?.identityKind === 'anonymous') {
38
- const delegatedKeys = input.executeDeps.broker.assistantDelegatedAuthKeys?.();
39
- if (delegatedKeys !== undefined &&
40
- delegatedKeys.size > 0 &&
41
- toolTouchesDelegatedAuth(ambient, delegatedKeys)) {
42
- return { ...context, ambientStatus: 'unavailable' };
43
- }
44
- }
45
- const result = await executeAmbientContext(input.artifact, {
46
- ...input.executeDeps,
47
- ...(input.caller ? { caller: input.caller } : {}),
48
- context,
49
- });
50
- if (!result.ok)
51
- return { ...context, ambientStatus: 'unavailable' };
52
- return { ...context, ambientStatus: 'available', ambient: result.output };
53
- }
1
+ import { resolveInvocationContextSnapshot } from '@noodle-borg/assistant-gateway/portable';
54
2
  /** Bind the shared snapshot resolver to stateless MCP requests without coupling it to router code. */
55
3
  export function createMcpInvocationContextResolver(clock = () => new Date()) {
56
4
  return ({ target, caller, clientHint }) => resolveInvocationContextSnapshot({
@@ -1,5 +1,4 @@
1
- import { withAssistantSessionExecutionAuthority } from '@noodle-borg/assistant-gateway/portable';
2
- import { resolveInvocationContextSnapshot } from '../invocation-context.js';
1
+ import { resolveInvocationContextSnapshot, withAssistantSessionExecutionAuthority, } from '@noodle-borg/assistant-gateway/portable';
3
2
  import { now } from './assistant.js';
4
3
  export function assistantInteractionScope(id, session, instant) {
5
4
  return {
@@ -29,7 +29,7 @@ export async function handlePublicAssistantConfiguration(req, res, embedId, deps
29
29
  if (target === undefined) {
30
30
  return sendJson(res, 409, { error: 'assistant deployment is unavailable' });
31
31
  }
32
- const resolved = await effectiveAssistantBrowserConfiguration(target.served.artifact.server, publicEmbedTenant(authorized.embed), deps.appearance);
32
+ const resolved = await effectiveAssistantBrowserConfiguration(target.served.artifact.server, publicEmbedTenant(authorized.embed), deps.appearance, 'public');
33
33
  applyBrowserCors(req, res, origin);
34
34
  res.setHeader('cache-control', 'private, no-cache');
35
35
  return sendJson(res, 200, {
@@ -59,7 +59,7 @@ export async function handlePublicAssistantSession(req, res, deps) {
59
59
  if (!target?.deploymentId)
60
60
  throw new Error('assistant deployment vanished mid-mint');
61
61
  const current = now(deps);
62
- configuration = (await effectiveAssistantBrowserConfiguration(target.served.artifact.server, publicEmbedTenant(input.embed), deps.appearance)).effective;
62
+ configuration = (await effectiveAssistantBrowserConfiguration(target.served.artifact.server, publicEmbedTenant(input.embed), deps.appearance, 'public')).effective;
63
63
  const created = await deps.store.createSession({
64
64
  // A public surface has no client credential, so the embed id stands in as the minting
65
65
  // authority. It is not a secret and nothing downstream may begin treating it as one.
@@ -1,8 +1,7 @@
1
1
  import { ADMISSION_DEFAULTS } from '@noodle-borg/admission-limits/portable';
2
- import { parseAssistantContextPreferences, surfaceEnvelope, withAssistantSessionExecutionAuthority, } from '@noodle-borg/assistant-gateway/portable';
2
+ import { parseAssistantContextPreferences, resolveInvocationContextSnapshot, surfaceEnvelope, withAssistantSessionExecutionAuthority, } from '@noodle-borg/assistant-gateway/portable';
3
3
  import { assistantSuggestionsRequestSchema } from '@noodle-borg/wire-contracts';
4
4
  import { readJsonBody, sendJson } from '../http-util.js';
5
- import { resolveInvocationContextSnapshot } from '../invocation-context.js';
6
5
  import { generateInitialAssistantSuggestions } from './assistant-agent.js';
7
6
  import { applyBrowserCors, authenticateSession, now } from './assistant-route-http.js';
8
7
  import { sessionScopedTarget } from './assistant-session-target.js';
@@ -1,15 +1,13 @@
1
1
  import { clientAddressBucket, } from '@noodle-borg/admission-limits/portable';
2
2
  import { assistantModelFailure, assistantModelSource, assistantModelTransport, } from '@noodle-borg/assistant-gateway/model-runtime';
3
- import { ASSISTANT_SESSION_IDLE_MS, dispatchAssistantTool, effectiveAssistantBrowserConfiguration, isAssistantPageContext, isAssistantVerifiedClaims, parseAssistantContextPreferences, parseAssistantCustomerRouting, refuseBridgeToolCall, refusePublicTurn, resumeTurnMessage, resumeUnavailableMessage, shouldAutoResume, surfaceBindingForOrigin, withAssistantSessionExecutionAuthority, } from '@noodle-borg/assistant-gateway/portable';
3
+ import { ASSISTANT_SESSION_IDLE_MS, effectiveAssistantBrowserConfiguration, executeAssistantAppToolCall, isAssistantPageContext, isAssistantVerifiedClaims, parseAssistantContextPreferences, parseAssistantCustomerRouting, refuseBridgeToolCall, refusePublicTurn, resolveInvocationContextSnapshot, resumeTurnMessage, resumeUnavailableMessage, shouldAutoResume, surfaceBindingForOrigin, withAssistantSessionExecutionAuthority, } from '@noodle-borg/assistant-gateway/portable';
4
4
  import { canonicalizeAuthorizationClaimValues } from '@noodle-borg/auth';
5
- import { validateJsonSchemaWithDefaults } from '@noodle-borg/compiler';
6
5
  import { tenantMcpUrl } from '@noodle-borg/module';
7
- import { assistantRefusedTurnUsageRequestEvent, assistantSessionUsageRequestEvent, assistantTurnNumber, assistantTurnUsageRequestEvent, captureAssistantUsage, } from '@noodle-borg/observability';
8
- import { evaluateToolAuthorization, mapExecutionError, mapResourceContents, mapResourcesList, mapToolOutput, mapToolsList, } from '@noodle-borg/protocol';
6
+ import { assistantAppToolCallRecorder, assistantRefusedTurnUsageRequestEvent, assistantSessionUsageRequestEvent, assistantTurnNumber, assistantTurnUsageRequestEvent, captureAssistantUsage, } from '@noodle-borg/observability';
7
+ import { mapExecutionError, mapResourceContents, mapResourcesList, mapToolOutput, mapToolsList, } from '@noodle-borg/protocol';
9
8
  import { executeResource } from '@noodle-borg/runtime';
10
9
  import { assistantMessageTurnRequestSchema, assistantResumeTurnRequestSchema, assistantSessionResponseSchema, } from '@noodle-borg/wire-contracts';
11
10
  import { readJsonBody, sendForbidden, sendJson, sendUnauthorized } from '../http-util.js';
12
- import { resolveInvocationContextSnapshot } from '../invocation-context.js';
13
11
  import { createAssistantTurnStats, runAgentTurn } from './assistant-agent.js';
14
12
  import { elevateAssistantSession } from './assistant-elevation.js';
15
13
  import { executeAssistantKnowledgeSearch, findAssistantKnowledgeComponent, resolveAssistantKnowledge, } from './assistant-knowledge.js';
@@ -99,7 +97,7 @@ export async function handleAssistantSession(req, res, deps) {
99
97
  const declaredClaims = assistant.sessionClaims ?? {};
100
98
  const claims = Object.fromEntries(Object.entries(isAssistantVerifiedClaims(parsed.claims) ? parsed.claims : {}).filter(([key]) => key in declaredClaims));
101
99
  const current = now(deps);
102
- const configuration = (await effectiveAssistantBrowserConfiguration(target.served.artifact.server, client.tenant, deps.appearance)).effective;
100
+ const configuration = (await effectiveAssistantBrowserConfiguration(target.served.artifact.server, client.tenant, deps.appearance, surfaceBinding.kind === 'pre-surfaces' ? undefined : surfaceBinding.kind)).effective;
103
101
  const roles = canonicalizeAuthorizationClaimValues(parsed.user.roles, 'role');
104
102
  const scopes = canonicalizeAuthorizationClaimValues(parsed.user.scopes, 'scope');
105
103
  // Hoisted so an elevation and a fresh exchange bind the *same* principal. Two constructions would be
@@ -387,9 +385,21 @@ export async function handleAssistantAppRequest(req, res, deps) {
387
385
  // Answered before any resolution work, so a refused browser agent costs nothing (ADR 0220). The
388
386
  // marker is client-declared: it selects a budget, never authority, which the session below decides.
389
387
  const bridged = method === 'tools/call' && body.value.bridge === 'webmcp';
388
+ // Bound before the budget gate below, because that refusal is the one an operator watching a
389
+ // browser agent most needs to see, and answering it before any resolution work must not mean
390
+ // answering it silently. `bridged` is attribution only: it labels the row, never authority.
391
+ const record = assistantAppToolCallRecorder({
392
+ capture: deps.captureRequestEvent,
393
+ session,
394
+ ...(typeof params.name === 'string' ? { toolName: params.name } : { toolName: undefined }),
395
+ bridged,
396
+ clock: () => performance.now(),
397
+ });
390
398
  const refusal = bridged ? await refuseBridgeToolCall(deps, session) : undefined;
391
- if (refusal)
399
+ if (refusal) {
400
+ record('refused', refusal.code);
392
401
  return sendJson(res, refusal.status, { error: refusal.message, code: refusal.code });
402
+ }
393
403
  const knowledge = await resolveAssistantKnowledge(target.served);
394
404
  if (method === 'tools/list') {
395
405
  return sendJson(res, 200, mapToolsList(target.served.artifact, session.caller, {
@@ -405,15 +415,18 @@ export async function handleAssistantAppRequest(req, res, deps) {
405
415
  const resource = target.served.artifact.resources?.find((candidate) => candidate.uri === params.uri);
406
416
  if (!resource)
407
417
  return sendJson(res, 404, { error: 'resource not found' });
418
+ // One projection for both the snapshot and the execution: they must agree, and building it
419
+ // twice was two chances for them not to.
420
+ const executeDeps = withAssistantSessionExecutionAuthority(target.served.deps, target.served.artifact, session);
408
421
  const context = await resolveInvocationContextSnapshot({
409
422
  artifact: target.served.artifact,
410
- executeDeps: withAssistantSessionExecutionAuthority(target.served.deps, target.served.artifact, session),
423
+ executeDeps,
411
424
  caller: session.caller,
412
425
  instant: now(deps),
413
426
  ...(session.preferences ? { applicationPreference: session.preferences } : {}),
414
427
  });
415
428
  const execution = await executeResource(target.served.artifact, resource.name, {}, {
416
- ...withAssistantSessionExecutionAuthority(target.served.deps, target.served.artifact, session),
429
+ ...executeDeps,
417
430
  caller: session.caller,
418
431
  context,
419
432
  });
@@ -422,58 +435,64 @@ export async function handleAssistantAppRequest(req, res, deps) {
422
435
  return sendJson(res, 200, mapResourceContents(resource.uri, resource.mimeType, execution.output, resource._meta));
423
436
  }
424
437
  if (method === 'tools/call') {
425
- if (typeof params.name !== 'string')
438
+ if (typeof params.name !== 'string') {
439
+ record('refused', 'tool_name_required');
426
440
  return sendJson(res, 400, { error: 'tool name required' });
427
- const knowledgeComponent = findAssistantKnowledgeComponent(knowledge, params.name);
441
+ }
442
+ const toolName = params.name;
443
+ const knowledgeComponent = findAssistantKnowledgeComponent(knowledge, toolName);
428
444
  if (knowledge !== undefined && knowledgeComponent !== undefined) {
429
445
  const content = await executeAssistantKnowledgeSearch(knowledge, knowledgeComponent, params.arguments ?? {});
430
- return sendJson(res, 200, mapToolOutput(JSON.parse(content)));
446
+ // A knowledge search reports failure in its payload rather than by throwing, so reading the
447
+ // envelope is the only way not to file a refused or failed search as a successful one.
448
+ const payload = JSON.parse(content);
449
+ const failure = isRecord(payload) && typeof payload.error === 'string' ? payload.error : undefined;
450
+ if (failure === undefined)
451
+ record('ok');
452
+ else
453
+ record(failure === 'invalid_arguments' ? 'refused' : 'failed', failure);
454
+ return sendJson(res, 200, mapToolOutput(payload));
431
455
  }
432
- const tool = target.served.artifact.tools.find((candidate) => candidate.name === params.name);
433
- if (!tool || tool._meta?.ui?.visibility?.includes('app') === false) {
456
+ const call = await executeAssistantAppToolCall({
457
+ artifact: target.served.artifact,
458
+ deps: target.served.deps,
459
+ session,
460
+ toolName,
461
+ arguments: params.arguments,
462
+ now: () => now(deps),
463
+ store: deps.store,
464
+ audit: deps.audit,
465
+ });
466
+ if (call.kind === 'not-found') {
467
+ record('refused', 'app_tool_not_found');
434
468
  return sendJson(res, 404, { error: 'app tool not found' });
435
469
  }
436
- if (!evaluateToolAuthorization(tool.authorization, session.caller).allow) {
470
+ if (call.kind === 'forbidden') {
471
+ record('refused', 'tool_forbidden');
437
472
  return sendJson(res, 403, { error: 'tool forbidden' });
438
473
  }
439
- const context = await resolveInvocationContextSnapshot({
440
- artifact: target.served.artifact,
441
- executeDeps: withAssistantSessionExecutionAuthority(target.served.deps, target.served.artifact, session),
442
- caller: session.caller,
443
- instant: now(deps),
444
- ...(session.preferences ? { applicationPreference: session.preferences } : {}),
445
- });
446
- const validated = validateJsonSchemaWithDefaults(tool.inputSchema, params.arguments ?? {});
447
- if (validated.issues.length > 0) {
474
+ if (call.kind === 'invalid-arguments') {
475
+ record('refused', 'invalid_tool_arguments');
448
476
  return sendJson(res, 200, {
449
477
  content: [{ type: 'text', text: 'invalid tool arguments' }],
450
478
  isError: true,
451
479
  });
452
480
  }
453
- const dispatched = await dispatchAssistantTool({
454
- artifact: target.served.artifact,
455
- tool,
456
- arguments: validated.value,
457
- executeDeps: withAssistantSessionExecutionAuthority(target.served.deps, target.served.artifact, session),
458
- caller: session.caller,
459
- context,
460
- session,
461
- store: deps.store,
462
- audit: deps.audit,
463
- now: () => now(deps),
464
- });
465
- if (dispatched.kind === 'event') {
466
- if (dispatched.event === 'tool_proposed' || dispatched.event === 'input_requested') {
467
- return sendJson(res, 200, {
468
- interaction: { event: dispatched.event, data: dispatched.data },
469
- });
470
- }
481
+ if (call.kind === 'interaction') {
482
+ // A raised confirmation is not a failure and not yet an execution: the bridge did what it
483
+ // should, and the interaction is answered on its own route.
484
+ record('ok');
485
+ return sendJson(res, 200, { interaction: { event: call.event, data: call.data } });
486
+ }
487
+ if (call.kind === 'error') {
488
+ record('failed', call.code);
471
489
  return sendJson(res, 200, {
472
- content: [{ type: 'text', text: String(dispatched.data.code ?? dispatched.event) }],
490
+ content: [{ type: 'text', text: call.code }],
473
491
  isError: true,
474
492
  });
475
493
  }
476
- return sendJson(res, 200, mapToolOutput(dispatched.output));
494
+ record('ok');
495
+ return sendJson(res, 200, mapToolOutput(call.output));
477
496
  }
478
497
  return sendJson(res, 400, { error: 'unsupported MCP App method' });
479
498
  }
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@modelcontextprotocol/sdk": "^1.29.0",
41
41
  "@noodle-borg/admission-limits": "0.0.0",
42
- "@noodle-borg/agent-kit": "0.88.0",
42
+ "@noodle-borg/agent-kit": "0.90.0",
43
43
  "@noodle-borg/app-package": "0.0.0",
44
44
  "@noodle-borg/assistant-gateway": "0.0.0",
45
45
  "@noodle-borg/auth": "0.0.0",
@@ -18,6 +18,7 @@ export * from './deployment-package.js';
18
18
  export * from './distribution.js';
19
19
  export * from './feedback.js';
20
20
  export * from './knowledge.js';
21
+ export * from './managed-assistant-sponsorship.js';
21
22
  export * from './platform-account-reset.js';
22
23
  export * from './platform-auth.js';
23
24
  /** Informational origin of a deployment; never an authorization or policy input. */
@@ -20,6 +20,7 @@ export * from './deployment-package.js';
20
20
  export * from './distribution.js';
21
21
  export * from './feedback.js';
22
22
  export * from './knowledge.js';
23
+ export * from './managed-assistant-sponsorship.js';
23
24
  export * from './platform-account-reset.js';
24
25
  export * from './platform-auth.js';
25
26
  // ─── Deploy ─────────────────────────────────────────────────────────────────────
@@ -0,0 +1,297 @@
1
+ import { z } from 'zod';
2
+ export declare const MANAGED_ASSISTANT_SPONSORSHIP_MAX_GRANT_TURNS_PER_DAY = 100000;
3
+ export declare const ManagedAssistantSponsorshipGrantCreateRequestSchema: z.ZodObject<{
4
+ additionalTurnsPerDay: z.ZodNumber;
5
+ startsAt: z.ZodOptional<z.ZodISODateTime>;
6
+ expiresAt: z.ZodISODateTime;
7
+ reason: z.ZodString;
8
+ idempotencyKey: z.ZodString;
9
+ }, z.core.$strict>;
10
+ export type ManagedAssistantSponsorshipGrantCreateRequest = z.infer<typeof ManagedAssistantSponsorshipGrantCreateRequestSchema>;
11
+ export declare const ManagedAssistantSponsorshipGrantRevokeRequestSchema: z.ZodObject<{
12
+ reason: z.ZodString;
13
+ idempotencyKey: z.ZodString;
14
+ }, z.core.$strict>;
15
+ export type ManagedAssistantSponsorshipGrantRevokeRequest = z.infer<typeof ManagedAssistantSponsorshipGrantRevokeRequestSchema>;
16
+ export declare const ManagedAssistantSponsorshipGrantSchema: z.ZodObject<{
17
+ id: z.ZodString;
18
+ billingAccountId: z.ZodString;
19
+ additionalTurnsPerDay: z.ZodNumber;
20
+ startsAt: z.ZodISODateTime;
21
+ expiresAt: z.ZodISODateTime;
22
+ reason: z.ZodString;
23
+ status: z.ZodEnum<{
24
+ active: "active";
25
+ revoked: "revoked";
26
+ scheduled: "scheduled";
27
+ expired: "expired";
28
+ }>;
29
+ createdAt: z.ZodISODateTime;
30
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
31
+ revocationReason: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strict>;
33
+ export type ManagedAssistantSponsorshipGrant = z.infer<typeof ManagedAssistantSponsorshipGrantSchema>;
34
+ export declare const ManagedAssistantSponsorshipResponseSchema: z.ZodObject<{
35
+ ok: z.ZodLiteral<true>;
36
+ data: z.ZodObject<{
37
+ billingAccountId: z.ZodString;
38
+ mode: z.ZodLiteral<"sponsored_beta">;
39
+ defaultTurnsPerDay: z.ZodNumber;
40
+ bonusTurnsPerDay: z.ZodNumber;
41
+ totalTurnsPerDay: z.ZodNumber;
42
+ spend: z.ZodObject<{
43
+ state: z.ZodEnum<{
44
+ normal: "normal";
45
+ approaching: "approaching";
46
+ near: "near";
47
+ limited: "limited";
48
+ closed: "closed";
49
+ }>;
50
+ allowanceUnits: z.ZodNumber;
51
+ usedUnitsToday: z.ZodNumber;
52
+ turnsRemaining: z.ZodNumber;
53
+ }, z.core.$strict>;
54
+ resetAt: z.ZodISODateTime;
55
+ grants: z.ZodArray<z.ZodObject<{
56
+ id: z.ZodString;
57
+ billingAccountId: z.ZodString;
58
+ additionalTurnsPerDay: z.ZodNumber;
59
+ startsAt: z.ZodISODateTime;
60
+ expiresAt: z.ZodISODateTime;
61
+ reason: z.ZodString;
62
+ status: z.ZodEnum<{
63
+ active: "active";
64
+ revoked: "revoked";
65
+ scheduled: "scheduled";
66
+ expired: "expired";
67
+ }>;
68
+ createdAt: z.ZodISODateTime;
69
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
70
+ revocationReason: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strict>>;
72
+ platform: z.ZodOptional<z.ZodObject<{
73
+ globalTurnsPerDay: z.ZodNumber;
74
+ spend: z.ZodObject<{
75
+ state: z.ZodEnum<{
76
+ normal: "normal";
77
+ approaching: "approaching";
78
+ near: "near";
79
+ limited: "limited";
80
+ closed: "closed";
81
+ }>;
82
+ allowanceUnits: z.ZodNumber;
83
+ usedUnitsToday: z.ZodNumber;
84
+ turnsRemaining: z.ZodNumber;
85
+ }, z.core.$strict>;
86
+ }, z.core.$strict>>;
87
+ }, z.core.$strict>;
88
+ }, z.core.$strict>;
89
+ export type ManagedAssistantSponsorshipResponse = z.infer<typeof ManagedAssistantSponsorshipResponseSchema>;
90
+ /** Client reader strips additive fields at every layer while the service output stays strict. */
91
+ export declare const ManagedAssistantSponsorshipClientResponseSchema: z.ZodObject<{
92
+ ok: z.ZodLiteral<true>;
93
+ data: z.ZodObject<{
94
+ spend: z.ZodObject<{
95
+ state: z.ZodEnum<{
96
+ normal: "normal";
97
+ approaching: "approaching";
98
+ near: "near";
99
+ limited: "limited";
100
+ closed: "closed";
101
+ }>;
102
+ allowanceUnits: z.ZodNumber;
103
+ usedUnitsToday: z.ZodNumber;
104
+ turnsRemaining: z.ZodNumber;
105
+ }, z.core.$strip>;
106
+ grants: z.ZodArray<z.ZodObject<{
107
+ id: z.ZodString;
108
+ billingAccountId: z.ZodString;
109
+ additionalTurnsPerDay: z.ZodNumber;
110
+ startsAt: z.ZodISODateTime;
111
+ expiresAt: z.ZodISODateTime;
112
+ reason: z.ZodString;
113
+ status: z.ZodEnum<{
114
+ active: "active";
115
+ revoked: "revoked";
116
+ scheduled: "scheduled";
117
+ expired: "expired";
118
+ }>;
119
+ createdAt: z.ZodISODateTime;
120
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
121
+ revocationReason: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strip>>;
123
+ platform: z.ZodOptional<z.ZodObject<{
124
+ globalTurnsPerDay: z.ZodNumber;
125
+ spend: z.ZodObject<{
126
+ state: z.ZodEnum<{
127
+ normal: "normal";
128
+ approaching: "approaching";
129
+ near: "near";
130
+ limited: "limited";
131
+ closed: "closed";
132
+ }>;
133
+ allowanceUnits: z.ZodNumber;
134
+ usedUnitsToday: z.ZodNumber;
135
+ turnsRemaining: z.ZodNumber;
136
+ }, z.core.$strip>;
137
+ }, z.core.$strip>>;
138
+ billingAccountId: z.ZodString;
139
+ mode: z.ZodLiteral<"sponsored_beta">;
140
+ defaultTurnsPerDay: z.ZodNumber;
141
+ bonusTurnsPerDay: z.ZodNumber;
142
+ totalTurnsPerDay: z.ZodNumber;
143
+ resetAt: z.ZodISODateTime;
144
+ }, z.core.$strip>;
145
+ }, z.core.$strip>;
146
+ export declare const ManagedAssistantSponsorshipGrantMutationResponseSchema: z.ZodObject<{
147
+ ok: z.ZodLiteral<true>;
148
+ data: z.ZodObject<{
149
+ replayed: z.ZodBoolean;
150
+ grant: z.ZodObject<{
151
+ id: z.ZodString;
152
+ billingAccountId: z.ZodString;
153
+ additionalTurnsPerDay: z.ZodNumber;
154
+ startsAt: z.ZodISODateTime;
155
+ expiresAt: z.ZodISODateTime;
156
+ reason: z.ZodString;
157
+ status: z.ZodEnum<{
158
+ active: "active";
159
+ revoked: "revoked";
160
+ scheduled: "scheduled";
161
+ expired: "expired";
162
+ }>;
163
+ createdAt: z.ZodISODateTime;
164
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
165
+ revocationReason: z.ZodOptional<z.ZodString>;
166
+ }, z.core.$strict>;
167
+ sponsorship: z.ZodObject<{
168
+ billingAccountId: z.ZodString;
169
+ mode: z.ZodLiteral<"sponsored_beta">;
170
+ defaultTurnsPerDay: z.ZodNumber;
171
+ bonusTurnsPerDay: z.ZodNumber;
172
+ totalTurnsPerDay: z.ZodNumber;
173
+ spend: z.ZodObject<{
174
+ state: z.ZodEnum<{
175
+ normal: "normal";
176
+ approaching: "approaching";
177
+ near: "near";
178
+ limited: "limited";
179
+ closed: "closed";
180
+ }>;
181
+ allowanceUnits: z.ZodNumber;
182
+ usedUnitsToday: z.ZodNumber;
183
+ turnsRemaining: z.ZodNumber;
184
+ }, z.core.$strict>;
185
+ resetAt: z.ZodISODateTime;
186
+ grants: z.ZodArray<z.ZodObject<{
187
+ id: z.ZodString;
188
+ billingAccountId: z.ZodString;
189
+ additionalTurnsPerDay: z.ZodNumber;
190
+ startsAt: z.ZodISODateTime;
191
+ expiresAt: z.ZodISODateTime;
192
+ reason: z.ZodString;
193
+ status: z.ZodEnum<{
194
+ active: "active";
195
+ revoked: "revoked";
196
+ scheduled: "scheduled";
197
+ expired: "expired";
198
+ }>;
199
+ createdAt: z.ZodISODateTime;
200
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
201
+ revocationReason: z.ZodOptional<z.ZodString>;
202
+ }, z.core.$strict>>;
203
+ platform: z.ZodOptional<z.ZodObject<{
204
+ globalTurnsPerDay: z.ZodNumber;
205
+ spend: z.ZodObject<{
206
+ state: z.ZodEnum<{
207
+ normal: "normal";
208
+ approaching: "approaching";
209
+ near: "near";
210
+ limited: "limited";
211
+ closed: "closed";
212
+ }>;
213
+ allowanceUnits: z.ZodNumber;
214
+ usedUnitsToday: z.ZodNumber;
215
+ turnsRemaining: z.ZodNumber;
216
+ }, z.core.$strict>;
217
+ }, z.core.$strict>>;
218
+ }, z.core.$strict>;
219
+ }, z.core.$strict>;
220
+ }, z.core.$strict>;
221
+ export type ManagedAssistantSponsorshipGrantMutationResponse = z.infer<typeof ManagedAssistantSponsorshipGrantMutationResponseSchema>;
222
+ export declare const ManagedAssistantSponsorshipGrantMutationClientResponseSchema: z.ZodObject<{
223
+ ok: z.ZodLiteral<true>;
224
+ data: z.ZodObject<{
225
+ replayed: z.ZodBoolean;
226
+ grant: z.ZodObject<{
227
+ id: z.ZodString;
228
+ billingAccountId: z.ZodString;
229
+ additionalTurnsPerDay: z.ZodNumber;
230
+ startsAt: z.ZodISODateTime;
231
+ expiresAt: z.ZodISODateTime;
232
+ reason: z.ZodString;
233
+ status: z.ZodEnum<{
234
+ active: "active";
235
+ revoked: "revoked";
236
+ scheduled: "scheduled";
237
+ expired: "expired";
238
+ }>;
239
+ createdAt: z.ZodISODateTime;
240
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
241
+ revocationReason: z.ZodOptional<z.ZodString>;
242
+ }, z.core.$strip>;
243
+ sponsorship: z.ZodObject<{
244
+ spend: z.ZodObject<{
245
+ state: z.ZodEnum<{
246
+ normal: "normal";
247
+ approaching: "approaching";
248
+ near: "near";
249
+ limited: "limited";
250
+ closed: "closed";
251
+ }>;
252
+ allowanceUnits: z.ZodNumber;
253
+ usedUnitsToday: z.ZodNumber;
254
+ turnsRemaining: z.ZodNumber;
255
+ }, z.core.$strip>;
256
+ grants: z.ZodArray<z.ZodObject<{
257
+ id: z.ZodString;
258
+ billingAccountId: z.ZodString;
259
+ additionalTurnsPerDay: z.ZodNumber;
260
+ startsAt: z.ZodISODateTime;
261
+ expiresAt: z.ZodISODateTime;
262
+ reason: z.ZodString;
263
+ status: z.ZodEnum<{
264
+ active: "active";
265
+ revoked: "revoked";
266
+ scheduled: "scheduled";
267
+ expired: "expired";
268
+ }>;
269
+ createdAt: z.ZodISODateTime;
270
+ revokedAt: z.ZodOptional<z.ZodISODateTime>;
271
+ revocationReason: z.ZodOptional<z.ZodString>;
272
+ }, z.core.$strip>>;
273
+ platform: z.ZodOptional<z.ZodObject<{
274
+ globalTurnsPerDay: z.ZodNumber;
275
+ spend: z.ZodObject<{
276
+ state: z.ZodEnum<{
277
+ normal: "normal";
278
+ approaching: "approaching";
279
+ near: "near";
280
+ limited: "limited";
281
+ closed: "closed";
282
+ }>;
283
+ allowanceUnits: z.ZodNumber;
284
+ usedUnitsToday: z.ZodNumber;
285
+ turnsRemaining: z.ZodNumber;
286
+ }, z.core.$strip>;
287
+ }, z.core.$strip>>;
288
+ billingAccountId: z.ZodString;
289
+ mode: z.ZodLiteral<"sponsored_beta">;
290
+ defaultTurnsPerDay: z.ZodNumber;
291
+ bonusTurnsPerDay: z.ZodNumber;
292
+ totalTurnsPerDay: z.ZodNumber;
293
+ resetAt: z.ZodISODateTime;
294
+ }, z.core.$strip>;
295
+ }, z.core.$strip>;
296
+ }, z.core.$strip>;
297
+ //# sourceMappingURL=managed-assistant-sponsorship.d.ts.map