@loxtep/sdk 0.2.3 → 0.3.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 (168) hide show
  1. package/README.md +141 -0
  2. package/dist/authoring/agent.d.ts +164 -0
  3. package/dist/authoring/agent.d.ts.map +1 -0
  4. package/dist/authoring/agent.js +376 -0
  5. package/dist/authoring/agent.js.map +1 -0
  6. package/dist/authoring/compiler.d.ts +98 -0
  7. package/dist/authoring/compiler.d.ts.map +1 -0
  8. package/dist/authoring/compiler.js +156 -0
  9. package/dist/authoring/compiler.js.map +1 -0
  10. package/dist/authoring/define-data-workflow.d.ts +24 -0
  11. package/dist/authoring/define-data-workflow.d.ts.map +1 -0
  12. package/dist/authoring/define-data-workflow.js +93 -0
  13. package/dist/authoring/define-data-workflow.js.map +1 -0
  14. package/dist/authoring/index.d.ts +19 -0
  15. package/dist/authoring/index.d.ts.map +1 -0
  16. package/dist/authoring/index.js +15 -0
  17. package/dist/authoring/index.js.map +1 -0
  18. package/dist/authoring/toolbox.d.ts +133 -0
  19. package/dist/authoring/toolbox.d.ts.map +1 -0
  20. package/dist/authoring/toolbox.js +166 -0
  21. package/dist/authoring/toolbox.js.map +1 -0
  22. package/dist/authoring/triggers.d.ts +41 -0
  23. package/dist/authoring/triggers.d.ts.map +1 -0
  24. package/dist/authoring/triggers.js +60 -0
  25. package/dist/authoring/triggers.js.map +1 -0
  26. package/dist/authoring/types.d.ts +64 -0
  27. package/dist/authoring/types.d.ts.map +1 -0
  28. package/dist/authoring/types.js +9 -0
  29. package/dist/authoring/types.js.map +1 -0
  30. package/dist/cli/commands/activity-cmd.d.ts +28 -0
  31. package/dist/cli/commands/activity-cmd.d.ts.map +1 -0
  32. package/dist/cli/commands/activity-cmd.js +78 -0
  33. package/dist/cli/commands/activity-cmd.js.map +1 -0
  34. package/dist/cli/commands/attach-cmd.d.ts +38 -0
  35. package/dist/cli/commands/attach-cmd.d.ts.map +1 -0
  36. package/dist/cli/commands/attach-cmd.js +141 -0
  37. package/dist/cli/commands/attach-cmd.js.map +1 -0
  38. package/dist/cli/commands/deploy-cmd.d.ts +101 -0
  39. package/dist/cli/commands/deploy-cmd.d.ts.map +1 -0
  40. package/dist/cli/commands/deploy-cmd.js +461 -0
  41. package/dist/cli/commands/deploy-cmd.js.map +1 -0
  42. package/dist/cli/commands/generate-cmd.d.ts +35 -0
  43. package/dist/cli/commands/generate-cmd.d.ts.map +1 -0
  44. package/dist/cli/commands/generate-cmd.js +134 -0
  45. package/dist/cli/commands/generate-cmd.js.map +1 -0
  46. package/dist/cli/commands/improvements-cmd.d.ts +44 -0
  47. package/dist/cli/commands/improvements-cmd.d.ts.map +1 -0
  48. package/dist/cli/commands/improvements-cmd.js +215 -0
  49. package/dist/cli/commands/improvements-cmd.js.map +1 -0
  50. package/dist/cli/commands/init-cmd.d.ts +78 -0
  51. package/dist/cli/commands/init-cmd.d.ts.map +1 -0
  52. package/dist/cli/commands/init-cmd.js +250 -0
  53. package/dist/cli/commands/init-cmd.js.map +1 -0
  54. package/dist/cli/commands/test-cmd.d.ts +89 -0
  55. package/dist/cli/commands/test-cmd.d.ts.map +1 -0
  56. package/dist/cli/commands/test-cmd.js +378 -0
  57. package/dist/cli/commands/test-cmd.js.map +1 -0
  58. package/dist/cli/index.d.ts +1 -1
  59. package/dist/cli/index.js +146 -4
  60. package/dist/cli/index.js.map +1 -1
  61. package/dist/cli/project-context.d.ts +153 -0
  62. package/dist/cli/project-context.d.ts.map +1 -0
  63. package/dist/cli/project-context.js +190 -0
  64. package/dist/cli/project-context.js.map +1 -0
  65. package/dist/client/activity-types.d.ts +66 -0
  66. package/dist/client/activity-types.d.ts.map +1 -0
  67. package/dist/client/activity-types.js +9 -0
  68. package/dist/client/activity-types.js.map +1 -0
  69. package/dist/client/activity.d.ts +22 -0
  70. package/dist/client/activity.d.ts.map +1 -0
  71. package/dist/client/activity.js +43 -0
  72. package/dist/client/activity.js.map +1 -0
  73. package/dist/client/data-products.d.ts.map +1 -1
  74. package/dist/client/data-products.js +4 -98
  75. package/dist/client/data-products.js.map +1 -1
  76. package/dist/client/flow-types.d.ts +4 -2
  77. package/dist/client/flow-types.d.ts.map +1 -1
  78. package/dist/client/flows.d.ts +1 -1
  79. package/dist/client/flows.d.ts.map +1 -1
  80. package/dist/client/flows.js +49 -124
  81. package/dist/client/flows.js.map +1 -1
  82. package/dist/client/improvements-types.d.ts +55 -0
  83. package/dist/client/improvements-types.d.ts.map +1 -0
  84. package/dist/client/improvements-types.js +9 -0
  85. package/dist/client/improvements-types.js.map +1 -0
  86. package/dist/client/improvements.d.ts +29 -0
  87. package/dist/client/improvements.d.ts.map +1 -0
  88. package/dist/client/improvements.js +50 -0
  89. package/dist/client/improvements.js.map +1 -0
  90. package/dist/client/index.d.ts +6 -2
  91. package/dist/client/index.d.ts.map +1 -1
  92. package/dist/client/index.js.map +1 -1
  93. package/dist/client/loxtep-client.d.ts +45 -0
  94. package/dist/client/loxtep-client.d.ts.map +1 -1
  95. package/dist/client/loxtep-client.js +68 -0
  96. package/dist/client/loxtep-client.js.map +1 -1
  97. package/dist/client/projects-types.d.ts +25 -0
  98. package/dist/client/projects-types.d.ts.map +1 -1
  99. package/dist/client/projects.d.ts +2 -1
  100. package/dist/client/projects.d.ts.map +1 -1
  101. package/dist/client/projects.js +17 -0
  102. package/dist/client/projects.js.map +1 -1
  103. package/dist/client/queue-types.d.ts +15 -2
  104. package/dist/client/queue-types.d.ts.map +1 -1
  105. package/dist/client/queues.d.ts.map +1 -1
  106. package/dist/client/queues.js +3 -14
  107. package/dist/client/queues.js.map +1 -1
  108. package/dist/codegen/emit.d.ts +25 -0
  109. package/dist/codegen/emit.d.ts.map +1 -0
  110. package/dist/codegen/emit.js +158 -0
  111. package/dist/codegen/emit.js.map +1 -0
  112. package/dist/codegen/index.d.ts +17 -0
  113. package/dist/codegen/index.d.ts.map +1 -0
  114. package/dist/codegen/index.js +16 -0
  115. package/dist/codegen/index.js.map +1 -0
  116. package/dist/codegen/load-workspace-context.d.ts +30 -0
  117. package/dist/codegen/load-workspace-context.d.ts.map +1 -0
  118. package/dist/codegen/load-workspace-context.js +127 -0
  119. package/dist/codegen/load-workspace-context.js.map +1 -0
  120. package/dist/codegen/normalize.d.ts +35 -0
  121. package/dist/codegen/normalize.d.ts.map +1 -0
  122. package/dist/codegen/normalize.js +77 -0
  123. package/dist/codegen/normalize.js.map +1 -0
  124. package/dist/codegen/types.d.ts +89 -0
  125. package/dist/codegen/types.d.ts.map +1 -0
  126. package/dist/codegen/types.js +9 -0
  127. package/dist/codegen/types.js.map +1 -0
  128. package/dist/codegen/write-artifact.d.ts +40 -0
  129. package/dist/codegen/write-artifact.d.ts.map +1 -0
  130. package/dist/codegen/write-artifact.js +74 -0
  131. package/dist/codegen/write-artifact.js.map +1 -0
  132. package/dist/config/index.d.ts +1 -0
  133. package/dist/config/index.d.ts.map +1 -1
  134. package/dist/config/index.js +1 -0
  135. package/dist/config/index.js.map +1 -1
  136. package/dist/config/workspace-config.d.ts +76 -0
  137. package/dist/config/workspace-config.d.ts.map +1 -0
  138. package/dist/config/workspace-config.js +129 -0
  139. package/dist/config/workspace-config.js.map +1 -0
  140. package/dist/index.d.ts +3 -0
  141. package/dist/index.d.ts.map +1 -1
  142. package/dist/index.js +3 -0
  143. package/dist/index.js.map +1 -1
  144. package/dist/rstreams/event-bridge.d.ts +16 -2
  145. package/dist/rstreams/event-bridge.d.ts.map +1 -1
  146. package/dist/rstreams/event-bridge.js +38 -5
  147. package/dist/rstreams/event-bridge.js.map +1 -1
  148. package/dist/skills/check-scope.d.ts +42 -0
  149. package/dist/skills/check-scope.d.ts.map +1 -0
  150. package/dist/skills/check-scope.js +84 -0
  151. package/dist/skills/check-scope.js.map +1 -0
  152. package/dist/skills/index.d.ts +14 -0
  153. package/dist/skills/index.d.ts.map +1 -0
  154. package/dist/skills/index.js +12 -0
  155. package/dist/skills/index.js.map +1 -0
  156. package/dist/skills/loader.d.ts +79 -0
  157. package/dist/skills/loader.d.ts.map +1 -0
  158. package/dist/skills/loader.js +102 -0
  159. package/dist/skills/loader.js.map +1 -0
  160. package/dist/skills/types.d.ts +55 -0
  161. package/dist/skills/types.d.ts.map +1 -0
  162. package/dist/skills/types.js +9 -0
  163. package/dist/skills/types.js.map +1 -0
  164. package/dist/skills/validate-references.d.ts +54 -0
  165. package/dist/skills/validate-references.d.ts.map +1 -0
  166. package/dist/skills/validate-references.js +80 -0
  167. package/dist/skills/validate-references.js.map +1 -0
  168. package/package.json +5 -3
package/README.md CHANGED
@@ -249,3 +249,144 @@ loxtep queue info <data-product-id>
249
249
  loxtep data-products query <data-product-id> "SELECT * FROM t LIMIT 10"
250
250
  loxtep metrics rate-limits
251
251
  ```
252
+
253
+ ## Module exports
254
+
255
+ The SDK also ships standalone modules for configuration, authentication,
256
+ code generation, skill scoping, and workflow authoring. Import them directly
257
+ from the relevant subpath.
258
+
259
+ ### `config` module
260
+
261
+ ```typescript
262
+ import { loadConfig, loadConfigSync, saveConfig } from '@loxtep/sdk/config';
263
+ ```
264
+
265
+ | Export | Type | Description |
266
+ | --- | --- | --- |
267
+ | `loadConfig` | function | Load config from env vars and optional file (async). Precedence: env > file > defaults |
268
+ | `loadConfigSync` | function | Synchronous variant of `loadConfig` using `readFileSync` |
269
+ | `saveConfig` | function | Persist config (api_url, org/project/instance IDs) to file. No secrets written to disk |
270
+ | `parseStreamsPartial` | function | Extract a partial bus config from unknown JSON, keeping only valid stream resource keys |
271
+ | `getConfigDir` | function | Return the default config directory path (`~/.loxtep`) |
272
+ | `getDefaultConfigPath` | function | Return the default config file path (`~/.loxtep/config.json`) |
273
+ | `buildAuthServiceUrl` | function | Build the full URL for auth endpoints (`/auth/login`, `/auth/refresh`) with path prefix |
274
+ | `extendClientBaseUrl` | function | Extend `api_url` with a microservice path segment, avoiding duplication |
275
+ | `buildPlatformRequestUrl` | function | Build a full request URL for the shared control-plane host, handling microservice routing |
276
+ | `resolveAutoConfig` | function | Resolve configuration with full precedence: env > explicit > workspace files |
277
+
278
+ ### `auth` module
279
+
280
+ ```typescript
281
+ import { login, refresh, browserLogin, TokenManager } from '@loxtep/sdk/auth';
282
+ ```
283
+
284
+ | Export | Type | Description |
285
+ | --- | --- | --- |
286
+ | `decodeJwtPayload` | function | Decode JWT payload to read `exp` (expiry) without verification. Client-side only |
287
+ | `login` | function | Authenticate with email/password via `POST /auth/login`. Returns access + refresh tokens |
288
+ | `refresh` | function | Refresh an access token via `POST /auth/refresh` |
289
+ | `browserLogin` | function | Run OAuth 2.1 browser-based login flow with a localhost callback server |
290
+ | `TokenManager` | class | In-memory token manager with auto-refresh support. No tokens persisted to disk |
291
+ | `LoginMfaRequiredError` | class | Error thrown when login returns 403 and the user must supply a TOTP code |
292
+
293
+ ### `codegen` module
294
+
295
+ ```typescript
296
+ import { loadWorkspaceContext, deriveKey, normalizeContext, emitArtifact, writeArtifact, computeCounts } from '@loxtep/sdk/codegen';
297
+ ```
298
+
299
+ | Export | Type | Description |
300
+ | --- | --- | --- |
301
+ | `loadWorkspaceContext` | function | Fetch all workspace resources from the control plane and assemble a `WorkspaceContext` |
302
+ | `deriveKey` | function | Derive a deterministic, valid TypeScript identifier key from a resource name |
303
+ | `normalizeContext` | function | Transform raw `WorkspaceContext` into canonical `NormalizedContext` with stable keys and id-sorted ordering |
304
+ | `emitArtifact` | function | Render a `NormalizedContext` into a complete TypeScript source string with `as const` exports |
305
+ | `writeArtifact` | function | Atomic file write of the generated artifact; returns per-resource-type counts |
306
+ | `computeCounts` | function | Compute per-resource-type counts from a `NormalizedContext` |
307
+
308
+ ### `skills` module
309
+
310
+ ```typescript
311
+ import { checkScope, parseSkillYaml, loadSkillsFromDirectory } from '@loxtep/sdk/skills';
312
+ ```
313
+
314
+ | Export | Type | Description |
315
+ | --- | --- | --- |
316
+ | `checkScope` | function | Fail-closed scope decision: check whether an operation on a resource is permitted by a skill |
317
+ | `checkScopeByName` | function | Resolve a skill by name from a map and check scope in one step |
318
+ | `parseSkillYaml` | function | Parse a YAML string into a validated `SkillDefinition` |
319
+ | `loadSkillFromFile` | function | Load a single skill definition from a `.yaml` file path |
320
+ | `loadSkillsFromDirectory` | function | Load all skill definitions from a `.loxtep/skills/` directory |
321
+ | `validateSkillReferences` | function | Validate all skill resource references against the loaded `WorkspaceContext` |
322
+ | `formatSkillValidationErrors` | function | Format skill validation errors into human-readable messages |
323
+ | `SkillDefinitionSchema` | object | Zod schema for validating skill definition YAML structure |
324
+
325
+ ### `authoring` module
326
+
327
+ ```typescript
328
+ import { defineDataWorkflow, on, createToolbox, agent } from '@loxtep/sdk/authoring';
329
+ ```
330
+
331
+ | Export | Type | Description |
332
+ | --- | --- | --- |
333
+ | `defineDataWorkflow` | function | Validate and return a `DataWorkflowModule` spec. Throws `ValidationError` on invalid input |
334
+ | `on` | object | Trigger builders: `queueEvent`, `connectorEvent`, `schedule`, `webhook` |
335
+ | `createToolbox` | function | Create a deterministic typed platform-call toolbox (no model in the loop) |
336
+ | `agent` | function | Agentic operation entry point with scope enforcement and action trace |
337
+ | `validateAgentOptions` | function | Validate agent options (prompt length, skills references) against available skills |
338
+ | `computeReachableScope` | function | Compute the union of all resource scopes from supplied skill definitions |
339
+ | `enforceAgentScope` | function | Check whether a resource access is within the merged scope of the agent's skills |
340
+ | `createScopeGuardedToolbox` | function | Create a scope-guarded proxy that enforces scope and records traces before every call |
341
+ | `compileModule` | function | Pure compiler: lower a `DataWorkflowModule` into `GraphPatchOp[]` for deployment |
342
+ | `computeRemovalSet` | function | Compute workflows present on instance but absent from project modules (for cleanup) |
343
+ | `ActionTrace` | class | Mutable action trace recorder with monotonically increasing sequence numbers |
344
+ | `AgentScopeError` | class | Error thrown when an agentic operation is blocked due to a scope violation |
345
+ | `ToolboxOperationError` | class | Error thrown when a toolbox operation fails (network, validation, or platform error) |
346
+
347
+ ### `http` module
348
+
349
+ ```typescript
350
+ import { signRequest, LoxtepHttpClient } from '@loxtep/sdk/http';
351
+ ```
352
+
353
+ | Export | Type | Description |
354
+ | --- | --- | --- |
355
+ | `signRequest` | function | Sign an HTTP request with AWS SigV4 for API Gateway (`execute-api`). Returns headers including `Authorization` and `x-amz-*` |
356
+ | `LoxtepHttpClient` | class | HTTP client that signs requests with AWS SigV4 and attaches JWT. Provides `get`, `post`, `put`, `delete` helpers with retry on 5xx/network errors and typed Loxtep errors on 4xx |
357
+
358
+ ### `checkpoint` module
359
+
360
+ ```typescript
361
+ import { createMemoryCheckpointStore } from '@loxtep/sdk/checkpoint';
362
+ ```
363
+
364
+ | Export | Type | Description |
365
+ | --- | --- | --- |
366
+ | `createMemoryCheckpointStore` | function | Create an in-memory checkpoint store for stream/replay resume. Suitable for tests or single-process use |
367
+
368
+ ### Error classes
369
+
370
+ ```typescript
371
+ import { AuthorizationError, ConflictError, ValidationError, DefinitionValidationError, SchemaValidationError, CheckpointError, parseHttpError } from '@loxtep/sdk/errors';
372
+ ```
373
+
374
+ | Export | Type | Description |
375
+ | --- | --- | --- |
376
+ | `AuthorizationError` | class | 403 — Insufficient permissions |
377
+ | `ConflictError` | class | 409 — Resource already exists or version conflict |
378
+ | `ValidationError` | class | 400 — Invalid input with optional `field_errors` array |
379
+ | `DefinitionValidationError` | class | 400 — Payload doesn't match data product definition (schema validation failures) |
380
+ | `SchemaValidationError` | class | Alias for `DefinitionValidationError` (backend terminology) |
381
+ | `CheckpointError` | class | 500 — Failed to save or load a stream checkpoint |
382
+ | `parseHttpError` | function | Map an HTTP status code and response body to the appropriate typed Loxtep error class |
383
+
384
+ ### `DataProductResolver` class
385
+
386
+ ```typescript
387
+ import { DataProductResolver } from '@loxtep/sdk/client';
388
+ ```
389
+
390
+ | Export | Type | Description |
391
+ | --- | --- | --- |
392
+ | `DataProductResolver` | class | Resolves a data product name or UUID into full runtime configuration (queue name, bot_id, stream bus resources). Caches results in memory. Used internally by `client.data_products.get_writer`/`get_reader` |
@@ -0,0 +1,164 @@
1
+ /**
2
+ * `agent()` entry point — agentic operations with input validation,
3
+ * client-side scope enforcement, and action trace recording.
4
+ *
5
+ * The agentic path accepts a prompt and a skills allowlist, validates inputs,
6
+ * enforces scope boundaries before any platform call, and records every
7
+ * operation as an ordered ActionTraceEntry.
8
+ *
9
+ * Requirements: 4.2, 4.3, 4.4, 4.5, 4.6, 7.1
10
+ */
11
+ import { LoxtepError } from '../errors/base.js';
12
+ import type { SkillDefinition, SkillScope, Operation, ScopeDecision } from '../skills/types.js';
13
+ import type { HandlerContext } from './types.js';
14
+ import type { Toolbox } from './toolbox.js';
15
+ /**
16
+ * A reference to a skill from the Generated_SDK_Artifact.
17
+ * Must contain at minimum a `name` field that matches a loaded skill definition.
18
+ */
19
+ export interface SkillRef {
20
+ name: string;
21
+ }
22
+ /**
23
+ * Options for the `agent()` entry point.
24
+ */
25
+ export interface AgentOptions {
26
+ /** The prompt for the agentic operation. 1–10,000 characters, non-empty (R4.2, R4.6). */
27
+ prompt: string;
28
+ /** Skills allowlist. 1–50 refs, each present in the generated artifact (R4.2, R4.6). */
29
+ skills: SkillRef[];
30
+ }
31
+ /**
32
+ * Outcome of an action trace entry.
33
+ */
34
+ export type ActionOutcome = 'succeeded' | 'failed' | 'blocked';
35
+ /**
36
+ * A single entry in the action trace recording an operation's execution.
37
+ * Ordered by execution start time (monotonic sequence, R4.5, R7.1).
38
+ */
39
+ export interface ActionTraceEntry {
40
+ /** Monotonically increasing sequence number (1-based). */
41
+ seq: number;
42
+ /** The type of operation: deterministic toolbox call or agentic step. */
43
+ kind: 'toolbox' | 'agentic' | 'scope_check';
44
+ /** The operation name (e.g. 'dataProducts.write', 'scope_enforcement'). */
45
+ operationName: string;
46
+ /** The target resource identifier, if applicable. */
47
+ targetResource?: string;
48
+ /** Execution start time (ISO 8601 UTC). */
49
+ startedAt: string;
50
+ /** Execution completion time (ISO 8601 UTC). */
51
+ completedAt: string;
52
+ /** Outcome of the operation. */
53
+ outcome: ActionOutcome;
54
+ /** Error message if the operation failed or was blocked. */
55
+ error?: string;
56
+ }
57
+ /**
58
+ * The result of an `agent()` invocation.
59
+ */
60
+ export interface AgentResult {
61
+ /** Whether the overall agentic operation succeeded. */
62
+ success: boolean;
63
+ /** The action trace recording every operation executed. */
64
+ trace: ActionTraceEntry[];
65
+ /** Error if the operation terminated due to a scope violation or failure. */
66
+ error?: {
67
+ code: string;
68
+ message: string;
69
+ deniedResource?: string;
70
+ };
71
+ }
72
+ /**
73
+ * Internal context for the agent execution environment.
74
+ */
75
+ export interface AgentExecutionContext {
76
+ /** The handler context (workflow name, instance, project). */
77
+ handlerContext: HandlerContext;
78
+ /** The resolved skill definitions for the supplied skills. */
79
+ skillDefinitions: SkillDefinition[];
80
+ /** The available toolbox for making platform calls. */
81
+ toolbox: Toolbox;
82
+ /** The set of valid skill names from the generated artifact. */
83
+ availableSkillNames: Set<string>;
84
+ }
85
+ /**
86
+ * Validate the agent options (prompt + skills).
87
+ * Throws ValidationError on invalid input (R4.6).
88
+ *
89
+ * @param options - The agent options to validate.
90
+ * @param availableSkillNames - Set of skill names present in the generated artifact.
91
+ */
92
+ export declare function validateAgentOptions(options: AgentOptions, availableSkillNames: Set<string>): void;
93
+ /**
94
+ * Compute the union of all resource scopes from the supplied skill definitions.
95
+ * The reachable set is the union of all skills' scopes (R4.3).
96
+ *
97
+ * @param skills - The skill definitions to union.
98
+ * @returns A merged SkillScope representing all reachable resources.
99
+ */
100
+ export declare function computeReachableScope(skills: SkillDefinition[]): SkillDefinition;
101
+ /**
102
+ * Check whether a resource access is within the merged scope of the agent's skills.
103
+ * Blocks out-of-scope reaches before any platform call (R4.4).
104
+ *
105
+ * @param mergedSkill - The merged skill scope (union of all supplied skills).
106
+ * @param resourceType - The resource type being accessed.
107
+ * @param resourceId - The resource identifier being accessed.
108
+ * @param operation - The operation being attempted.
109
+ * @returns The scope decision.
110
+ */
111
+ export declare function enforceAgentScope(mergedSkill: SkillDefinition, resourceType: keyof SkillScope, resourceId: string, operation: Operation): ScopeDecision;
112
+ /**
113
+ * Mutable action trace recorder. Assigns monotonically increasing sequence
114
+ * numbers to each entry (R4.5, R7.1).
115
+ */
116
+ export declare class ActionTrace {
117
+ private readonly entries;
118
+ private seq;
119
+ /**
120
+ * Record a completed operation in the trace.
121
+ */
122
+ record(entry: Omit<ActionTraceEntry, 'seq'>): ActionTraceEntry;
123
+ /**
124
+ * Get all recorded entries in order.
125
+ */
126
+ getEntries(): ActionTraceEntry[];
127
+ /**
128
+ * Get the current sequence number (number of recorded entries).
129
+ */
130
+ getSeq(): number;
131
+ }
132
+ /**
133
+ * Error thrown when an agentic operation is blocked due to a scope violation.
134
+ */
135
+ export declare class AgentScopeError extends LoxtepError {
136
+ readonly deniedResource: string;
137
+ constructor(deniedResource: string, code: string, message: string);
138
+ }
139
+ /**
140
+ * The `agent()` entry point for agentic operations within a data workflow handler.
141
+ *
142
+ * Validates inputs (R4.6), restricts the model to the supplied skills (R4.3),
143
+ * blocks out-of-scope reaches before any platform call (R4.4), and records
144
+ * every operation in an ordered action trace (R4.5, R7.1).
145
+ *
146
+ * @param ctx - Handler context (workflow name, instance, project).
147
+ * @param options - Agent options (prompt + skills allowlist).
148
+ * @param execContext - Execution context with resolved skills + toolbox.
149
+ * @returns The agent result including the action trace.
150
+ * @throws {ValidationError} If prompt or skills are invalid (R4.6).
151
+ */
152
+ export declare function agent(ctx: HandlerContext, options: AgentOptions, execContext: AgentExecutionContext): Promise<AgentResult>;
153
+ /**
154
+ * Create a scope-guarded proxy around the toolbox. Every method call goes through
155
+ * scope enforcement first; if denied, the call is blocked, a trace entry is recorded,
156
+ * and an AgentScopeError is thrown terminating the operation (R4.4).
157
+ *
158
+ * @param toolbox - The underlying toolbox.
159
+ * @param mergedSkill - The merged skill scope for enforcement.
160
+ * @param trace - The action trace to record operations.
161
+ * @returns A guarded toolbox that enforces scope and records traces.
162
+ */
163
+ export declare function createScopeGuardedToolbox(toolbox: Toolbox, mergedSkill: SkillDefinition, trace: ActionTrace): Toolbox;
164
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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