@noodleseed/one 0.132.2 → 0.134.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 (102) hide show
  1. package/dist/commands/author-loop.d.ts.map +1 -1
  2. package/dist/commands/author-loop.js +3 -3
  3. package/dist/commands/author-loop.js.map +1 -1
  4. package/dist/commands/devtools.js +1 -1
  5. package/dist/commands/devtools.js.map +1 -1
  6. package/dist/commands/local-readiness.d.ts +2 -2
  7. package/dist/commands/local-readiness.d.ts.map +1 -1
  8. package/dist/commands/local-readiness.js +15 -7
  9. package/dist/commands/local-readiness.js.map +1 -1
  10. package/dist/dev-local-runtime.d.ts +33 -0
  11. package/dist/dev-local-runtime.d.ts.map +1 -0
  12. package/dist/dev-local-runtime.js +53 -0
  13. package/dist/dev-local-runtime.js.map +1 -0
  14. package/dist/dev.d.ts +4 -0
  15. package/dist/dev.d.ts.map +1 -1
  16. package/dist/dev.js +109 -31
  17. package/dist/dev.js.map +1 -1
  18. package/dist/devtools-harness.js +5 -3
  19. package/dist/devtools-harness.js.map +1 -1
  20. package/dist/devtools-preview.d.ts +2 -0
  21. package/dist/devtools-preview.d.ts.map +1 -1
  22. package/dist/devtools-preview.js +15 -3
  23. package/dist/devtools-preview.js.map +1 -1
  24. package/dist/devtools-rpc-forwarder.js +1 -1
  25. package/dist/devtools-rpc-forwarder.js.map +1 -1
  26. package/dist/preview-session.d.ts.map +1 -1
  27. package/dist/preview-session.js +1 -0
  28. package/dist/preview-session.js.map +1 -1
  29. package/dist/react-widget-build.d.ts +4 -0
  30. package/dist/react-widget-build.d.ts.map +1 -1
  31. package/dist/react-widget-build.js +9 -0
  32. package/dist/react-widget-build.js.map +1 -1
  33. package/node_modules/@noodle-borg/admission-limits/dist/client-address.d.ts +7 -0
  34. package/node_modules/@noodle-borg/admission-limits/dist/counter-store.d.ts +71 -0
  35. package/node_modules/@noodle-borg/admission-limits/dist/envelope.d.ts +67 -0
  36. package/node_modules/@noodle-borg/admission-limits/dist/in-memory-counter-store.d.ts +15 -0
  37. package/node_modules/@noodle-borg/admission-limits/dist/portable.d.ts +6 -0
  38. package/node_modules/@noodle-borg/admission-limits/dist/portable.js +6 -0
  39. package/node_modules/@noodle-borg/admission-limits/package.json +8 -0
  40. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +6 -6
  41. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +1 -1
  42. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +4 -1
  43. package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
  44. package/node_modules/@noodle-borg/assistant-gateway/dist/artifact-projection.d.ts +21 -0
  45. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-context.d.ts +25 -0
  46. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-customer-issuer.d.ts +3 -0
  47. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-customer-routing.d.ts +19 -0
  48. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-guide.d.ts +39 -0
  49. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-interaction-state.d.ts +181 -0
  50. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-interactive.d.ts +99 -0
  51. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-interactive.js +1 -1
  52. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-presentation.d.ts +35 -0
  53. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-sensitive-values.d.ts +3 -0
  54. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-store.d.ts +226 -0
  55. package/node_modules/@noodle-borg/assistant-gateway/dist/assistant-store.js +1 -1
  56. package/node_modules/@noodle-borg/assistant-gateway/dist/elevation-store.d.ts +70 -0
  57. package/node_modules/@noodle-borg/assistant-gateway/dist/elevation.d.ts +68 -0
  58. package/node_modules/@noodle-borg/assistant-gateway/dist/embed-script.d.ts +24 -0
  59. package/node_modules/@noodle-borg/assistant-gateway/dist/embed-store.d.ts +73 -0
  60. package/node_modules/@noodle-borg/assistant-gateway/dist/in-memory-elevation-store.d.ts +21 -0
  61. package/node_modules/@noodle-borg/assistant-gateway/dist/in-memory-embed-store.d.ts +28 -0
  62. package/node_modules/@noodle-borg/assistant-gateway/dist/portable.d.ts +24 -0
  63. package/node_modules/@noodle-borg/assistant-gateway/dist/public-session.d.ts +56 -0
  64. package/node_modules/@noodle-borg/assistant-gateway/dist/public-surface.d.ts +21 -0
  65. package/node_modules/@noodle-borg/assistant-gateway/dist/public-surface.js +2 -1
  66. package/node_modules/@noodle-borg/assistant-gateway/dist/public-turn.d.ts +44 -0
  67. package/node_modules/@noodle-borg/assistant-gateway/dist/session-resume.d.ts +22 -0
  68. package/node_modules/@noodle-borg/assistant-gateway/dist/surface-budget.d.ts +16 -0
  69. package/node_modules/@noodle-borg/assistant-gateway/dist/surface-budget.js +1 -1
  70. package/node_modules/@noodle-borg/assistant-gateway/dist/tenant-ref.d.ts +13 -0
  71. package/node_modules/@noodle-borg/authoring/dist/assistant.d.ts +9 -2
  72. package/node_modules/@noodle-borg/authoring/dist/assistant.js +8 -2
  73. package/node_modules/@noodle-borg/authoring/dist/connectors.d.ts +3 -1
  74. package/node_modules/@noodle-borg/authoring/dist/connectors.js +5 -1
  75. package/node_modules/@noodle-borg/authoring/dist/server.d.ts +2 -1
  76. package/node_modules/@noodle-borg/authoring/dist/server.js +4 -1
  77. package/node_modules/@noodle-borg/compiler/dist/artifact/assemble.js +1 -1
  78. package/node_modules/@noodle-borg/compiler/dist/artifact/config.js +25 -20
  79. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +16 -12
  80. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +18 -13
  81. package/node_modules/@noodle-borg/connector-defs/dist/compile-http.js +2 -0
  82. package/node_modules/@noodle-borg/connector-defs/dist/schema.d.ts +3 -3
  83. package/node_modules/@noodle-borg/connector-defs/dist/schema.js +6 -1
  84. package/node_modules/@noodle-borg/connector-http/dist/http-connector.js +31 -8
  85. package/node_modules/@noodle-borg/protocol/dist/mapping.js +8 -0
  86. package/node_modules/@noodle-borg/runtime/dist/index.d.ts +1 -0
  87. package/node_modules/@noodle-borg/runtime/dist/index.js +1 -0
  88. package/node_modules/@noodle-borg/runtime/dist/managed-origins.d.ts +11 -0
  89. package/node_modules/@noodle-borg/runtime/dist/managed-origins.js +105 -0
  90. package/node_modules/@noodle-borg/service/dist/local-options.d.ts +9 -0
  91. package/node_modules/@noodle-borg/service/dist/registry-compile.js +12 -12
  92. package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.js +14 -3
  93. package/node_modules/@noodle-borg/service/dist/routes/assistant-embeds.js +1 -1
  94. package/node_modules/@noodle-borg/service/dist/routes/assistant-public-session.js +1 -1
  95. package/node_modules/@noodle-borg/service/dist/routes/assistant-public-turn.js +1 -1
  96. package/node_modules/@noodle-borg/service/dist/routes/assistant.js +1 -1
  97. package/node_modules/@noodle-borg/service/dist/serve-local.js +2 -3
  98. package/node_modules/@noodle-borg/service/package.json +1 -1
  99. package/node_modules/@noodleseed/assistant/README.md +4 -1
  100. package/package.json +5 -3
  101. package/node_modules/@noodle-borg/admission-limits/dist/index.js +0 -15
  102. package/node_modules/@noodle-borg/admission-limits/dist/postgres-counter-store.js +0 -68
@@ -122,7 +122,7 @@ export function renderAuthoringWorkflowReference() {
122
122
  ']);',
123
123
  '```',
124
124
  '',
125
- 'Naming: connector operation names and tool names are lowercase-with-underscores. Map with `${args.field}` for tool/operation inputs and `${response.path}` for the response — the parsed JSON body is bound directly to `${response}`, so there is **no `.body` envelope**; use bracket syntax for array indices (`${response.data[0].id}`) — a dotted numeric index like `.0.` is invalid. Declare URL query parameters with the operation-level `query: ["arg"]` array, **not** inside `request` (which builds only the JSON body). `allowedOrigins` must be literal origin URLs (the SSRF allowlist); `baseUrl` may be a `variable(...)` that differs by env.',
125
+ 'Naming: connector operation names and tool names are lowercase-with-underscores. Map with `${args.field}` for tool/operation inputs and `${response.path}` for the response — the parsed JSON body is bound directly to `${response}`, so there is **no `.body` envelope**; use bracket syntax for array indices (`${response.data[0].id}`) — a dotted numeric index like `.0.` is invalid. Declare URL query parameters with the operation-level `query: ["arg"]` array, **not** inside `request` (which builds only the JSON body). `allowedOrigins` is the SSRF allowlist: use literal exact origins, or the same `variable("STORE_ORIGIN")` as `baseUrl` when one reusable single-origin app is bound per business. A managed origin must resolve to one canonical bare HTTPS origin (exact loopback HTTP is the development exception); never use a wildcard, path, or tenant source edit.',
126
126
  '',
127
127
  'More: `auth.kind` is `bearer` | `apiKey` (needs `header`) | `clientCredentials` | `delegatedOAuth` | `delegatedSessionCookie` | `delegatedTokenExchange`. For client credentials use `{ kind: "clientCredentials", tokenUrl, clientId, clientSecret, scopes? }` (RFC-6749 grant); for a non-standard partner token endpoint add `profile: "custom"` with a `custom: { requestFormat, clientIdField, clientSecretField, tokenResponsePath, expirySource }` descriptor. Do not put credential headers in operation `headers`; use connector `auth`. Use `.compute(name, { input, output, run })` for a sandboxed transform; `provides:` (instead of `use:`) exposes a connector only to compute `callOperation`; and `noodle import openapi <file>` generates a connector from an OpenAPI spec.',
128
128
  '',
@@ -63,7 +63,7 @@ export function renderEmbeddedAssistantReference() {
63
63
  '}),',
64
64
  '```',
65
65
  '',
66
- 'Origins are exact: scheme, host, and optional port, with no path, trailing slash, or wildcard. Production origins must be HTTPS; plain HTTP is accepted only for loopback development origins (`http://localhost:<port>`, `http://127.0.0.1:<port>`). `noodle dev` serves the MCP project, not the embedding SaaS.',
66
+ 'Origins are exact: scheme, host, and optional port, with no path, trailing slash, or wildcard. Production origins must be HTTPS; plain HTTP is accepted only for loopback development origins (`http://localhost:<port>`, `http://127.0.0.1:<port>`). `noodle dev` serves the MCP project, not the embedding SaaS. For a public surface it also prints a process-local Embed ID and script; mount that script on the separately running loopback website to test anonymous mint, chat, widgets, and confirmation. The local ID is ephemeral, while a hosted deploy provisions the stable ID behind durable admission counters.',
67
67
  '',
68
68
  '## Product workflow guidance',
69
69
  '',
@@ -82,6 +82,7 @@ export function renderEmbeddedAssistantReference() {
82
82
  ' publicWebsite({',
83
83
  ' origins: ["https://www.example.com"],',
84
84
  ' capabilities: [answerProductQuestion, requestDemo],',
85
+ ' instructions: "Help visitors understand the best workflow for their goal before inviting a next step.",',
85
86
  ' }),',
86
87
  ' authenticatedWebsite({',
87
88
  ' origins: ["https://app.example.com"],',
@@ -92,6 +93,8 @@ export function renderEmbeddedAssistantReference() {
92
93
  '',
93
94
  'At most one public surface (`public` or `mixed`) and at most one authenticated surface, and no origin may appear on two surfaces — otherwise "which projection is this request?" would be ambiguous. Each gets its own embed snippet, budget, and kill switch.',
94
95
  '',
96
+ 'Keep shared, host-neutral product truth in `server.instructions`. Use a surface `instructions` value only for the voice, goals, boundaries, and next-step invitations appropriate to that front door. It is trimmed, non-empty, and at most 4,000 characters. The service injects it only after binding the exact website surface; it never enters MCP `initialize` or another assistant surface. For a public sales assistant, be consultative rather than pushy: deliver useful diagnosis or guidance before asking for contact details, and never put secrets in instructions.',
97
+ '',
95
98
  '`publicWebsite` is for a page with no signed-in user. The visitor is an **anonymous principal**, not an empty user: there is no `${user}`, no roles, no scopes, no customer routing, and no delegated credentials. A tool that needs identity — because it reads `${user}` or declares an `authorization` requirement — cannot be projected to a `public` surface, and the compiler says so.',
96
99
  '',
97
100
  'A public surface **must** declare `capabilities`: the exact positive allowlist it may reach. It is required by the type, and it is the whole externally reachable surface — a reviewer should read it in one screenful. Anything absent stays private, and a capability added to the server later is excluded until someone lists it. `authenticatedWebsite` may also take `capabilities` to narrow the in-app surface; omitted, it projects the whole server.',
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noodle-borg/agent-kit",
3
- "version": "0.79.0",
3
+ "version": "0.80.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -0,0 +1,21 @@
1
+ import { type RuntimeArtifact } from '@noodle-borg/compiler';
2
+ /**
3
+ * One surface's view of a deployment's artifact.
4
+ *
5
+ * The design choice worth preserving: this projects the **artifact object**, not the readers. A dozen
6
+ * call sites across the turn, interaction, and execution paths do `artifact.tools.find(...)`; handing
7
+ * each a filtered artifact means an unlisted tool is not hidden but *absent*, so none of them needs to
8
+ * know projection exists. Filtering the readers instead would be a dozen places to forget — and would
9
+ * leave the paths the compiler cannot close over (a `callServerTool` target, an elicitation branch)
10
+ * unguarded at runtime, which is exactly the gap this is the backstop for.
11
+ *
12
+ * It is deliberately a pure filter with no cache. "One projected view per session" means one *seam*,
13
+ * not memoisation; a `(deployment, surface)` memo can be added later if anything measures it.
14
+ */
15
+ /** What the author selected for this surface, from the compiled manifest. */
16
+ export interface SurfaceCapabilityRef {
17
+ readonly kind: 'tool' | 'resource' | 'prompt' | 'knowledge';
18
+ readonly name: string;
19
+ }
20
+ export declare function projectArtifactForSurface(artifact: RuntimeArtifact, capabilities: readonly SurfaceCapabilityRef[]): RuntimeArtifact;
21
+ //# sourceMappingURL=artifact-projection.d.ts.map
@@ -0,0 +1,25 @@
1
+ import type { InvocationContext } from '@noodle-borg/runtime';
2
+ export interface AssistantContextPreferences {
3
+ readonly locale?: string | undefined;
4
+ readonly timeZone?: string | undefined;
5
+ }
6
+ interface ResolveInvocationContextInput {
7
+ readonly instant: Date;
8
+ readonly applicationPreference?: AssistantContextPreferences;
9
+ readonly clientHint?: AssistantContextPreferences;
10
+ readonly defaults?: AssistantContextPreferences;
11
+ }
12
+ export type AssistantContextPreferencesResult = {
13
+ readonly ok: true;
14
+ readonly value: AssistantContextPreferences;
15
+ } | {
16
+ readonly ok: false;
17
+ };
18
+ /** Resolve presentation preferences independently from server-authoritative time. */
19
+ export declare function resolveInvocationContext(input: ResolveInvocationContextInput): InvocationContext;
20
+ /** Stable temporal grounding line shared by normal turns and interaction continuations. */
21
+ export declare function invocationContextSystemMessage(context: InvocationContext): string;
22
+ /** Validate and canonicalize a backend-supplied preference object at the session boundary. */
23
+ export declare function parseAssistantContextPreferences(value: unknown): AssistantContextPreferencesResult;
24
+ export {};
25
+ //# sourceMappingURL=assistant-context.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Private delegated-credential identity namespace derived at the authenticated client boundary. */
2
+ export declare function assistantCustomerIssuer(clientId: string): string;
3
+ //# sourceMappingURL=assistant-customer-issuer.d.ts.map
@@ -0,0 +1,19 @@
1
+ import type { CustomerEndpointPolicy, RuntimeArtifact } from '@noodle-borg/compiler';
2
+ import { type ExecuteDeps, freezeCustomerRoutes } from '@noodle-borg/runtime';
3
+ import type { AssistantSessionRecord } from './assistant-store.js';
4
+ export type AssistantCustomerRouting = Readonly<Record<string, string>>;
5
+ export type AssistantCustomerRoutingResult = {
6
+ readonly ok: true;
7
+ readonly customerRouting?: AssistantCustomerRouting;
8
+ } | {
9
+ readonly ok: false;
10
+ readonly endpoint?: string;
11
+ };
12
+ /** Validate and canonicalize private customer endpoint authority supplied by an embed backend. */
13
+ export declare function parseAssistantCustomerRouting(declarations: Readonly<Record<string, CustomerEndpointPolicy>> | undefined, input: unknown): AssistantCustomerRoutingResult;
14
+ /** Reconstruct all private assistant execution authority from one authenticated session snapshot. */
15
+ export declare function withAssistantSessionExecutionAuthority<T extends ExecuteDeps>(deps: T, artifact: Pick<RuntimeArtifact, 'customerEndpoints'>, session: Pick<AssistantSessionRecord, 'clientId' | 'customerRouting'>): T & {
16
+ readonly customerIssuer: string;
17
+ readonly customerRoutes?: ReturnType<typeof freezeCustomerRoutes>;
18
+ };
19
+ //# sourceMappingURL=assistant-customer-routing.d.ts.map
@@ -0,0 +1,39 @@
1
+ import type { ArtifactTool, RuntimeArtifact } from '@noodle-borg/compiler';
2
+ import { type ToolAuthorizationCaller } from '@noodle-borg/protocol';
3
+ import { type SurfaceCapabilityRef } from './artifact-projection.js';
4
+ /** Model-context budget for the embedded assistant's compact product workflow projection. */
5
+ export declare const ASSISTANT_GUIDE_MAX_BYTES: number;
6
+ export type AssistantGuideUnavailableReason = 'package_unavailable' | 'no_complete_workflow' | 'context_too_large';
7
+ export type AssistantGuideProjection = {
8
+ readonly status: 'ready';
9
+ readonly guide: {
10
+ readonly content: string;
11
+ readonly workflowIds: readonly string[];
12
+ readonly byteLength: number;
13
+ };
14
+ } | {
15
+ readonly status: 'unavailable';
16
+ readonly reason: AssistantGuideUnavailableReason;
17
+ };
18
+ /**
19
+ * Select the exact deployment tools an embedded model may see for this turn.
20
+ *
21
+ * A mixed anonymous surface deliberately advertises only its declared tools so the existing elevation
22
+ * interceptor can turn an attempted gated call into a sign-in offer. The selector performs that projection
23
+ * itself: callers cannot opt into sign-in offers without supplying the surface capability boundary. Every
24
+ * other caller gets the normal authorization filter. App-only tools never enter model tools or guidance.
25
+ */
26
+ export declare function selectAssistantModelTools(artifact: RuntimeArtifact, caller: (ToolAuthorizationCaller & {
27
+ readonly identityKind?: string;
28
+ }) | undefined, options?: {
29
+ readonly anonymousSignInOfferSurface?: readonly SurfaceCapabilityRef[];
30
+ }): readonly ArtifactTool[];
31
+ /**
32
+ * Build bounded product guidance from structured App Package data, never from rendered host files.
33
+ * Workflows are atomic: if one step is unavailable to this model, the entire workflow is omitted.
34
+ */
35
+ export declare function projectAssistantGuide(input: {
36
+ readonly appPackage: unknown;
37
+ readonly modelTools: readonly ArtifactTool[];
38
+ }): AssistantGuideProjection;
39
+ //# sourceMappingURL=assistant-guide.d.ts.map
@@ -0,0 +1,181 @@
1
+ import type { InvocationContext } from '@noodle-borg/runtime';
2
+ export declare const DEFAULT_MAX_PENDING_INTERACTIONS_PER_SESSION = 8;
3
+ export declare const ASSISTANT_INTERACTION_OUTCOME_RETENTION_MS: number;
4
+ /** Recovery grace for an in-flight action before its outcome becomes unknowable and payload is scrubbed. */
5
+ export declare const ASSISTANT_INTERACTION_EXECUTING_GRACE_MS: number;
6
+ export type AssistantInteractionKind = 'confirmation' | 'input';
7
+ export type AssistantInteractionStatus = 'pending' | 'executing' | 'succeeded' | 'failed' | 'declined' | 'cancelled';
8
+ export type AssistantInteractionPublicScalar = string | number | boolean | null;
9
+ export interface AssistantInteractionPublicArray extends ReadonlyArray<AssistantInteractionPublicValue> {
10
+ readonly [index: number]: AssistantInteractionPublicValue;
11
+ }
12
+ export interface AssistantInteractionPublicObject {
13
+ readonly [key: string]: AssistantInteractionPublicValue;
14
+ }
15
+ export type AssistantInteractionPublicValue = AssistantInteractionPublicScalar | AssistantInteractionPublicArray | AssistantInteractionPublicObject;
16
+ /** Compact replay-safe data only. Exact connector output and errors must never enter this shape. */
17
+ export interface AssistantInteractionPublicOutcome {
18
+ readonly code: string;
19
+ readonly summary: string;
20
+ readonly details?: Readonly<Record<string, AssistantInteractionPublicScalar>>;
21
+ readonly result?: AssistantInteractionPublicValue;
22
+ }
23
+ export declare const ASSISTANT_INTERACTION_UNKNOWN_OUTCOME: AssistantInteractionPublicOutcome;
24
+ interface AssistantInteractionCommon {
25
+ readonly id: string;
26
+ readonly sessionId: string;
27
+ readonly deploymentId: string;
28
+ /** Immutable proposal-time snapshot reused when the interaction resumes. */
29
+ readonly context?: InvocationContext;
30
+ /** Set when a terminal interaction's exact private payload has been removed. */
31
+ readonly payloadScrubbedAt?: string;
32
+ readonly createdAt: string;
33
+ readonly expiresAt: string;
34
+ }
35
+ interface AssistantConfirmationInteractionPayload {
36
+ readonly kind: 'confirmation';
37
+ readonly tool: string;
38
+ /** Exact validated arguments. Store-internal; renderers receive a separate review projection. */
39
+ readonly arguments: unknown;
40
+ /** Prepared post-elicitation execution state. Server-internal and absent on legacy proposals. */
41
+ readonly continuation?: unknown;
42
+ /** Complete, already-redacted review projection retained so a lost response can be replayed. */
43
+ readonly review?: unknown;
44
+ }
45
+ interface AssistantInputInteractionPayload {
46
+ readonly kind: 'input';
47
+ readonly tool: string;
48
+ readonly message: string;
49
+ readonly requestedSchema: Readonly<Record<string, unknown>>;
50
+ /** Exact runtime continuation. Store-internal and never part of the public interaction event. */
51
+ readonly continuation: unknown;
52
+ }
53
+ export interface AssistantPendingInteractionState {
54
+ readonly status: 'pending';
55
+ }
56
+ export interface AssistantExecutingInteractionState {
57
+ readonly status: 'executing';
58
+ readonly claimedAt: string;
59
+ }
60
+ export interface AssistantSucceededInteractionState {
61
+ readonly status: 'succeeded';
62
+ readonly claimedAt: string;
63
+ readonly completedAt: string;
64
+ readonly publicOutcome: AssistantInteractionPublicOutcome;
65
+ }
66
+ export interface AssistantFailedInteractionState {
67
+ readonly status: 'failed';
68
+ readonly claimedAt: string;
69
+ readonly completedAt: string;
70
+ readonly publicOutcome: AssistantInteractionPublicOutcome;
71
+ }
72
+ export interface AssistantDeclinedInteractionState {
73
+ readonly status: 'declined';
74
+ readonly completedAt: string;
75
+ readonly publicOutcome: AssistantInteractionPublicOutcome;
76
+ }
77
+ export interface AssistantCancelledInteractionState {
78
+ readonly status: 'cancelled';
79
+ readonly completedAt: string;
80
+ readonly publicOutcome: AssistantInteractionPublicOutcome;
81
+ }
82
+ export type AssistantInteractionState = AssistantPendingInteractionState | AssistantExecutingInteractionState | AssistantSucceededInteractionState | AssistantFailedInteractionState | AssistantDeclinedInteractionState | AssistantCancelledInteractionState;
83
+ export type AssistantTerminalInteractionState = AssistantSucceededInteractionState | AssistantFailedInteractionState | AssistantDeclinedInteractionState | AssistantCancelledInteractionState;
84
+ export type AssistantConfirmationInteractionRecord = AssistantInteractionCommon & AssistantConfirmationInteractionPayload & AssistantInteractionState;
85
+ export type AssistantInputInteractionRecord = AssistantInteractionCommon & AssistantInputInteractionPayload & AssistantInteractionState;
86
+ export type AssistantInteractionRecord = AssistantConfirmationInteractionRecord | AssistantInputInteractionRecord;
87
+ export type AssistantPendingConfirmationInteractionRecord = AssistantInteractionCommon & AssistantConfirmationInteractionPayload & AssistantPendingInteractionState;
88
+ export type AssistantPendingInputInteractionRecord = AssistantInteractionCommon & AssistantInputInteractionPayload & AssistantPendingInteractionState;
89
+ export type AssistantPendingInteractionRecord = AssistantPendingConfirmationInteractionRecord | AssistantPendingInputInteractionRecord;
90
+ interface AssistantInteractionCreateCommon {
91
+ readonly sessionId: string;
92
+ readonly deploymentId: string;
93
+ readonly context?: InvocationContext;
94
+ /** Omit only when the persistence adapter should stamp its own proposal time. */
95
+ readonly createdAt?: string;
96
+ readonly expiresAt: string;
97
+ }
98
+ export type AssistantConfirmationInteractionCreateInput = AssistantInteractionCreateCommon & Omit<AssistantConfirmationInteractionPayload, never>;
99
+ export type AssistantInputInteractionCreateInput = AssistantInteractionCreateCommon & Omit<AssistantInputInteractionPayload, never>;
100
+ export type AssistantInteractionCreateInput = AssistantConfirmationInteractionCreateInput | AssistantInputInteractionCreateInput;
101
+ export interface AssistantInteractionScope {
102
+ readonly id: string;
103
+ readonly sessionId: string;
104
+ readonly deploymentId: string;
105
+ readonly now: Date;
106
+ }
107
+ export type AssistantInteractionClaimResult = {
108
+ readonly disposition: 'claimed';
109
+ readonly interaction: AssistantInteractionRecord & AssistantExecutingInteractionState;
110
+ } | {
111
+ readonly disposition: 'replay';
112
+ readonly interaction: AssistantInteractionRecord;
113
+ } | {
114
+ readonly disposition: 'unavailable';
115
+ };
116
+ export type AssistantInteractionCompletion = {
117
+ readonly status: 'succeeded' | 'failed';
118
+ readonly publicOutcome: AssistantInteractionPublicOutcome;
119
+ } | {
120
+ readonly status: 'declined' | 'cancelled';
121
+ readonly publicOutcome?: AssistantInteractionPublicOutcome;
122
+ };
123
+ export type AssistantInteractionCompletionResult = {
124
+ readonly disposition: 'completed';
125
+ readonly interaction: AssistantInteractionRecord;
126
+ } | {
127
+ readonly disposition: 'replay';
128
+ readonly interaction: AssistantInteractionRecord;
129
+ } | {
130
+ readonly disposition: 'conflict';
131
+ readonly interaction: AssistantInteractionRecord;
132
+ } | {
133
+ readonly disposition: 'unavailable';
134
+ };
135
+ export type AssistantInteractionTransitionNext = Omit<AssistantConfirmationInteractionCreateInput, 'sessionId' | 'deploymentId' | 'createdAt'> | Omit<AssistantInputInteractionCreateInput, 'sessionId' | 'deploymentId' | 'createdAt'>;
136
+ /**
137
+ * Atomically records that an executing interaction handed control to one new pending interaction.
138
+ * The store owns the child identity and persists it in the parent's replay-safe public outcome.
139
+ */
140
+ export interface AssistantInteractionTransitionInput extends AssistantInteractionScope {
141
+ readonly publicOutcome: AssistantInteractionPublicOutcome;
142
+ readonly next: AssistantInteractionTransitionNext;
143
+ }
144
+ export type AssistantInteractionTransitionResult = {
145
+ readonly disposition: 'transitioned';
146
+ readonly interaction: AssistantInteractionRecord & AssistantSucceededInteractionState;
147
+ readonly next: AssistantPendingInteractionRecord;
148
+ } | {
149
+ readonly disposition: 'replay';
150
+ readonly interaction: AssistantInteractionRecord;
151
+ } | {
152
+ readonly disposition: 'conflict';
153
+ readonly interaction: AssistantInteractionRecord;
154
+ } | {
155
+ readonly disposition: 'unavailable';
156
+ };
157
+ export declare class AssistantInteractionCapacityError extends Error {
158
+ readonly code: "pending_interaction_limit";
159
+ constructor();
160
+ }
161
+ export declare function createPendingInteraction(id: string, input: AssistantConfirmationInteractionCreateInput): AssistantPendingConfirmationInteractionRecord;
162
+ export declare function createPendingInteraction(id: string, input: AssistantInputInteractionCreateInput): AssistantPendingInputInteractionRecord;
163
+ export declare function executingInteraction(interaction: AssistantInteractionRecord, claimedAt: Date): AssistantInteractionRecord & AssistantExecutingInteractionState;
164
+ export declare function completedInteraction(interaction: AssistantInteractionRecord, completion: AssistantInteractionCompletion, completedAt: Date): AssistantInteractionRecord & AssistantTerminalInteractionState;
165
+ export declare function transitionedInteractions(interaction: AssistantInteractionRecord, input: AssistantInteractionTransitionInput, nextId: string): {
166
+ readonly interaction: AssistantInteractionRecord & AssistantSucceededInteractionState;
167
+ readonly next: AssistantPendingInteractionRecord;
168
+ };
169
+ export declare function isTerminalInteraction(interaction: AssistantInteractionRecord): interaction is AssistantInteractionRecord & AssistantTerminalInteractionState;
170
+ /**
171
+ * Pending proposals expire at their decision deadline. Executing/unknown work keeps a tombstone, and a
172
+ * terminal public outcome remains replayable for a bounded reconciliation window after completion.
173
+ */
174
+ export declare function isPrunableInteraction(interaction: AssistantInteractionRecord, now: Date): boolean;
175
+ export declare function shouldExpireStrandedExecutingInteraction(interaction: AssistantInteractionRecord, now: Date): interaction is AssistantInteractionRecord & AssistantExecutingInteractionState;
176
+ /** Preserve a non-retryable unknown outcome without retaining its exact private payload. */
177
+ export declare function expireStrandedExecutingInteraction(interaction: AssistantInteractionRecord & AssistantExecutingInteractionState, scrubbedAt: Date): AssistantInteractionRecord & AssistantFailedInteractionState;
178
+ export declare function cloneInteraction<T extends AssistantInteractionRecord>(interaction: T): T;
179
+ export declare function normalizePublicOutcome(input: AssistantInteractionPublicOutcome): AssistantInteractionPublicOutcome;
180
+ export {};
181
+ //# sourceMappingURL=assistant-interaction-state.d.ts.map
@@ -0,0 +1,99 @@
1
+ import { type RuntimeArtifact } from '@noodle-borg/compiler';
2
+ import type { AuditSink } from '@noodle-borg/module';
3
+ import type { CallerIdentity, ConfirmationPreparationResult, ExecuteDeps, InteractiveExecutionResult, InvocationContext, PreparedToolContinuation, ToolContinuation, ToolPreparationContinuation } from '@noodle-borg/runtime';
4
+ import { type AssistantInteractionRecord, type AssistantInteractionTransitionNext, type AssistantPendingConfirmationInteractionRecord, type AssistantPendingInputInteractionRecord } from './assistant-interaction-state.js';
5
+ import type { AssistantSessionRecord, AssistantStore } from './assistant-store.js';
6
+ /**
7
+ * Single-use confirmation lifetime, owned by the admission envelope rather than restated here. The
8
+ * value is unchanged; what changes is that lowering `confirmationTtlMs` now does something, where
9
+ * before the envelope documented a bound this constant silently outranked.
10
+ */
11
+ export declare const ASSISTANT_INTERACTION_TTL_MS: number;
12
+ type InputRequired = Extract<InteractiveExecutionResult, {
13
+ readonly status: 'input_required';
14
+ }> | Extract<ConfirmationPreparationResult, {
15
+ readonly status: 'input_required';
16
+ }>;
17
+ export type AssistantToolDispatch = {
18
+ readonly kind: 'event';
19
+ readonly event: 'tool_proposed' | 'input_requested' | 'error';
20
+ readonly data: Readonly<Record<string, unknown>>;
21
+ } | {
22
+ readonly kind: 'tool_result';
23
+ readonly output: unknown;
24
+ };
25
+ /** Apply the same confirmation and suspend/resume policy to one model-proposed tool call. */
26
+ export declare function dispatchAssistantTool(input: {
27
+ readonly artifact: RuntimeArtifact;
28
+ readonly tool: RuntimeArtifact['tools'][number];
29
+ readonly arguments: unknown;
30
+ readonly executeDeps: ExecuteDeps;
31
+ readonly caller: CallerIdentity;
32
+ readonly context: InvocationContext;
33
+ readonly session: AssistantSessionRecord;
34
+ readonly store: AssistantStore;
35
+ readonly audit: AuditSink;
36
+ readonly now: () => Date;
37
+ readonly onToolStarted?: () => void;
38
+ }): Promise<AssistantToolDispatch>;
39
+ /** Persist a complete, reviewable proposal and its server-only prepared execution state. */
40
+ export declare function createAssistantConfirmationInteraction(input: {
41
+ readonly store: AssistantStore;
42
+ readonly audit: AuditSink;
43
+ readonly session: AssistantSessionRecord;
44
+ readonly context: InvocationContext;
45
+ readonly tool: string;
46
+ readonly arguments: unknown;
47
+ readonly review: unknown;
48
+ readonly continuation: PreparedToolContinuation;
49
+ readonly now: Date;
50
+ }): Promise<AssistantPendingConfirmationInteractionRecord>;
51
+ export declare function assistantConfirmationTransition(input: {
52
+ readonly context: InvocationContext;
53
+ readonly tool: string;
54
+ readonly arguments: unknown;
55
+ readonly review: unknown;
56
+ readonly continuation: PreparedToolContinuation;
57
+ readonly now: Date;
58
+ }): Extract<AssistantInteractionTransitionNext, {
59
+ readonly kind: 'confirmation';
60
+ }>;
61
+ export declare function assistantConfirmationProposalData(interaction: AssistantPendingConfirmationInteractionRecord): Readonly<Record<string, unknown>>;
62
+ /** Persist an opaque input interaction and audit only scalar metadata about the suspension. */
63
+ export declare function createAssistantInputInteraction(input: {
64
+ readonly store: AssistantStore;
65
+ readonly audit: AuditSink;
66
+ readonly session: AssistantSessionRecord;
67
+ readonly context: InvocationContext;
68
+ readonly required: InputRequired;
69
+ readonly now: Date;
70
+ }): Promise<AssistantPendingInputInteractionRecord>;
71
+ export declare function assistantInputTransition(input: {
72
+ readonly context: InvocationContext;
73
+ readonly required: InputRequired;
74
+ readonly now: Date;
75
+ }): Extract<AssistantInteractionTransitionNext, {
76
+ readonly kind: 'input';
77
+ }>;
78
+ /** Emit one tenant-scoped, scalar-only interaction audit record. */
79
+ export declare function auditAssistantInteraction(input: {
80
+ readonly audit: AuditSink;
81
+ readonly session: AssistantSessionRecord;
82
+ readonly interaction: AssistantInteractionRecord;
83
+ readonly eventType: 'assistant.interaction.proposed' | 'assistant.interaction.resolved' | 'assistant.interaction.execution';
84
+ readonly decision: 'allow' | 'deny';
85
+ readonly httpStatus: number;
86
+ readonly status: string;
87
+ readonly action?: 'accept' | 'decline' | 'cancel';
88
+ readonly reasonCode?: string;
89
+ }): Promise<void>;
90
+ export declare function assistantInteractionTool(interaction: AssistantInteractionRecord): string | undefined;
91
+ /** The store is the only trust boundary allowed to deserialize this runtime continuation. */
92
+ export declare function assistantToolContinuation(interaction: Extract<AssistantInteractionRecord, {
93
+ readonly kind: 'input';
94
+ }>): ToolContinuation | ToolPreparationContinuation;
95
+ export declare function assistantPreparedToolContinuation(interaction: Extract<AssistantInteractionRecord, {
96
+ readonly kind: 'confirmation';
97
+ }>): PreparedToolContinuation | undefined;
98
+ export {};
99
+ //# sourceMappingURL=assistant-interactive.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ADMISSION_DEFAULTS } from '@noodle-borg/admission-limits';
1
+ import { ADMISSION_DEFAULTS } from '@noodle-borg/admission-limits/portable';
2
2
  import { requiresToolConfirmation } from '@noodle-borg/compiler';
3
3
  import { evaluateToolAuthorization } from '@noodle-borg/protocol';
4
4
  import { executeToolInteractive, prepareToolForConfirmation } from '@noodle-borg/runtime';
@@ -0,0 +1,35 @@
1
+ import { type ConfirmationReview } from '@noodle-borg/runtime';
2
+ type JsonSchema = Readonly<Record<string, unknown>>;
3
+ type AssistantPresentationScalar = string | number | boolean | null;
4
+ interface AssistantPresentationArray extends ReadonlyArray<AssistantPresentationValue> {
5
+ }
6
+ interface AssistantPresentationObject {
7
+ readonly [key: string]: AssistantPresentationValue;
8
+ }
9
+ export type AssistantPresentationValue = AssistantPresentationScalar | AssistantPresentationArray | AssistantPresentationObject;
10
+ type ArgumentReview = {
11
+ readonly ok: true;
12
+ readonly value: unknown;
13
+ readonly reviewSchema: JsonSchema;
14
+ } | {
15
+ readonly ok: false;
16
+ readonly code: 'arguments_not_presentable';
17
+ };
18
+ /** Derive a client-visible review while retaining the exact validated arguments only in the store. */
19
+ export declare function assistantArgumentReview(schema: JsonSchema, value: unknown): ArgumentReview;
20
+ /** Present the original tool input plus every elicited value that will affect prepared execution. */
21
+ export declare function assistantPreparedArgumentReview(schema: JsonSchema, review: ConfirmationReview): ArgumentReview;
22
+ /** Attach portable display metadata to the already-persisted review JSON without changing execution input. */
23
+ export declare function assistantConfirmationReview(input: {
24
+ readonly title?: string;
25
+ readonly description: string;
26
+ readonly review: Extract<ArgumentReview, {
27
+ readonly ok: true;
28
+ }>;
29
+ }): Readonly<Record<string, unknown>>;
30
+ /** Decode enriched and legacy persisted reviews into the additive public proposal shape. */
31
+ export declare function assistantConfirmationProposal(review: unknown): Readonly<Record<string, unknown>>;
32
+ /** Redact and bound execution output before SSE, history, audit, or model narration. */
33
+ export declare function assistantSafeOutput(schema: JsonSchema | undefined, value: unknown): AssistantPresentationValue;
34
+ export {};
35
+ //# sourceMappingURL=assistant-presentation.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Catch common credential shapes even when a connector returns them under an innocuous key. */
2
+ export declare function isCredentialShapedAssistantText(value: string): boolean;
3
+ //# sourceMappingURL=assistant-sensitive-values.d.ts.map