@runtypelabs/sdk 9.3.0 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3441 -0
- package/dist/index.cjs +20 -80
- package/dist/index.d.cts +56 -626
- package/dist/index.d.ts +56 -626
- package/dist/index.mjs +20 -80
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -11190,7 +11190,7 @@ interface paths {
|
|
|
11190
11190
|
/** @default true */
|
|
11191
11191
|
createVersionOnChange?: boolean;
|
|
11192
11192
|
};
|
|
11193
|
-
/** @description Execution-lane selector. `false` is
|
|
11193
|
+
/** @description Execution-lane selector. `false` is RETIRED on AGENT dispatches: the legacy agent engine it selected has been deleted, so it is rejected with 400 LEGACY_AGENT_LANE_RETIRED (still carrying the RFC 9745 `Deprecation` + `X-API-Deprecation-Warning` response headers). Omitted and `true` are now IDENTICAL for agents: both run an eligible agent on the @runtypelabs/runtime lane, and both answer a definition the lane cannot execute faithfully with 400 RUNTIME_AGENT_PARITY_FOLD_UNSUPPORTED rather than degrading it. For FLOW dispatches the field is accepted but ignored: eligible flows always use the runtime lane, while ineligible flows still fold to legacy silently. */
|
|
11194
11194
|
useRuntimePackage?: boolean;
|
|
11195
11195
|
versionLabel?: string;
|
|
11196
11196
|
versionNotes?: string;
|
|
@@ -11206,7 +11206,7 @@ interface paths {
|
|
|
11206
11206
|
ownerId?: string;
|
|
11207
11207
|
type?: string;
|
|
11208
11208
|
};
|
|
11209
|
-
/** @description Retired. A NON-EMPTY map on an agent dispatch is rejected with 400 RUNTIME_AGENT_TRANSIENT_SECRETS_UNSUPPORTED
|
|
11209
|
+
/** @description Retired. A NON-EMPTY map on an agent dispatch is rejected with 400 RUNTIME_AGENT_TRANSIENT_SECRETS_UNSUPPORTED. There is no longer an exception: the legacy engine that honored it for single-turn agents behind `options.useRuntimePackage: false` has been removed, and that opt-out is itself a 400 now. An empty map is accepted and does nothing. Ignored on flow dispatches. Store credentials as managed secrets and reference them as {{secret:NAME}}. The field is kept on the wire for compatibility only. */
|
|
11210
11210
|
secrets?: {
|
|
11211
11211
|
[key: string]: string;
|
|
11212
11212
|
};
|
|
@@ -11565,7 +11565,7 @@ interface paths {
|
|
|
11565
11565
|
/** @default true */
|
|
11566
11566
|
createVersionOnChange?: boolean;
|
|
11567
11567
|
};
|
|
11568
|
-
/** @description Execution-lane selector. `false` is
|
|
11568
|
+
/** @description Execution-lane selector. `false` is RETIRED on AGENT dispatches: the legacy agent engine it selected has been deleted, so it is rejected with 400 LEGACY_AGENT_LANE_RETIRED (still carrying the RFC 9745 `Deprecation` + `X-API-Deprecation-Warning` response headers). Omitted and `true` are now IDENTICAL for agents: both run an eligible agent on the @runtypelabs/runtime lane, and both answer a definition the lane cannot execute faithfully with 400 RUNTIME_AGENT_PARITY_FOLD_UNSUPPORTED rather than degrading it. For FLOW dispatches the field is accepted but ignored: eligible flows always use the runtime lane, while ineligible flows still fold to legacy silently. */
|
|
11569
11569
|
useRuntimePackage?: boolean;
|
|
11570
11570
|
versionLabel?: string;
|
|
11571
11571
|
versionNotes?: string;
|
|
@@ -11581,7 +11581,7 @@ interface paths {
|
|
|
11581
11581
|
ownerId?: string;
|
|
11582
11582
|
type?: string;
|
|
11583
11583
|
};
|
|
11584
|
-
/** @description Retired. A NON-EMPTY map on an agent dispatch is rejected with 400 RUNTIME_AGENT_TRANSIENT_SECRETS_UNSUPPORTED
|
|
11584
|
+
/** @description Retired. A NON-EMPTY map on an agent dispatch is rejected with 400 RUNTIME_AGENT_TRANSIENT_SECRETS_UNSUPPORTED. There is no longer an exception: the legacy engine that honored it for single-turn agents behind `options.useRuntimePackage: false` has been removed, and that opt-out is itself a 400 now. An empty map is accepted and does nothing. Ignored on flow dispatches. Store credentials as managed secrets and reference them as {{secret:NAME}}. The field is kept on the wire for compatibility only. */
|
|
11585
11585
|
secrets?: {
|
|
11586
11586
|
[key: string]: string;
|
|
11587
11587
|
};
|
|
@@ -46969,13 +46969,6 @@ type StreamEventOf<U, T extends string> = Extract<U, {
|
|
|
46969
46969
|
type: T;
|
|
46970
46970
|
}>;
|
|
46971
46971
|
|
|
46972
|
-
/**
|
|
46973
|
-
* SSE Stream Utilities for FlowBuilder
|
|
46974
|
-
*
|
|
46975
|
-
* Provides utilities for parsing Server-Sent Events (SSE) streams
|
|
46976
|
-
* from the Runtype API dispatch endpoint.
|
|
46977
|
-
*/
|
|
46978
|
-
|
|
46979
46972
|
/**
|
|
46980
46973
|
* Options for the flow stream consumers.
|
|
46981
46974
|
*
|
|
@@ -47037,13 +47030,6 @@ declare function processStream(response: Response, callbacks?: StreamCallbacks,
|
|
|
47037
47030
|
*/
|
|
47038
47031
|
declare function streamEvents(response: Response, _options?: StreamConsumeOptions): AsyncGenerator<StreamEvent>;
|
|
47039
47032
|
|
|
47040
|
-
/**
|
|
47041
|
-
* FlowResult - Wrapper for streaming flow execution responses
|
|
47042
|
-
*
|
|
47043
|
-
* Provides convenient methods for processing streaming responses
|
|
47044
|
-
* from the Runtype API dispatch endpoint.
|
|
47045
|
-
*/
|
|
47046
|
-
|
|
47047
47033
|
/**
|
|
47048
47034
|
* Result wrapper for flow execution
|
|
47049
47035
|
*
|
|
@@ -47158,26 +47144,6 @@ declare class FlowResult {
|
|
|
47158
47144
|
private ensureNotConsumed;
|
|
47159
47145
|
}
|
|
47160
47146
|
|
|
47161
|
-
/**
|
|
47162
|
-
* FlowBuilder - Fluent builder for constructing dispatch configurations
|
|
47163
|
-
*
|
|
47164
|
-
* Provides a chainable API for building flows with steps, making flow
|
|
47165
|
-
* construction more readable and type-safe.
|
|
47166
|
-
*
|
|
47167
|
-
* @example
|
|
47168
|
-
* ```typescript
|
|
47169
|
-
* import { FlowBuilder } from '@runtypelabs/sdk'
|
|
47170
|
-
*
|
|
47171
|
-
* const config = new FlowBuilder()
|
|
47172
|
-
* .createFlow({ name: "My Flow" })
|
|
47173
|
-
* .withRecord({ name: "Record", type: "data", metadata: { key: "value" } })
|
|
47174
|
-
* .fetchUrl({ name: "Fetch", url: "https://api.example.com", outputVariable: "data" })
|
|
47175
|
-
* .prompt({ name: "Process", model: "gpt-4", userPrompt: "Analyze: {{data}}" })
|
|
47176
|
-
* .withOptions({ streamResponse: true, flowMode: "virtual" })
|
|
47177
|
-
* .build()
|
|
47178
|
-
* ```
|
|
47179
|
-
*/
|
|
47180
|
-
|
|
47181
47147
|
interface PromptStepConfig$1 {
|
|
47182
47148
|
name: string;
|
|
47183
47149
|
model: string;
|
|
@@ -47653,10 +47619,11 @@ interface DispatchOptions$1 {
|
|
|
47653
47619
|
loggingPolicy?: 'default' | 'on' | 'off';
|
|
47654
47620
|
/**
|
|
47655
47621
|
* Ignored for flows (runtime eligibility selects the engine). For agents,
|
|
47656
|
-
* `false` is
|
|
47657
|
-
*
|
|
47658
|
-
*
|
|
47659
|
-
*
|
|
47622
|
+
* `false` is RETIRED: the legacy agent engine it selected has been deleted,
|
|
47623
|
+
* so it is rejected with 400 `LEGACY_AGENT_LANE_RETIRED` (the response still
|
|
47624
|
+
* carries `Deprecation` headers). Omit the field, or send `true` — for agents
|
|
47625
|
+
* the two are now identical, and both answer a definition the runtime lane
|
|
47626
|
+
* cannot execute faithfully with a 400 rather than degrading it.
|
|
47660
47627
|
*/
|
|
47661
47628
|
useRuntimePackage?: boolean;
|
|
47662
47629
|
localInference?: {
|
|
@@ -48863,10 +48830,9 @@ interface FlowToolConfig {
|
|
|
48863
48830
|
flowId?: string;
|
|
48864
48831
|
toolId?: string;
|
|
48865
48832
|
/**
|
|
48866
|
-
* Inline flow definition.
|
|
48867
|
-
*
|
|
48868
|
-
*
|
|
48869
|
-
* reference.
|
|
48833
|
+
* Inline flow definition. Agent dispatches support this — every eligible
|
|
48834
|
+
* agent runs on the runtime lane, which resolves an inline flow — while
|
|
48835
|
+
* hosted flow definitions currently require a `flowId`/`toolId` reference.
|
|
48870
48836
|
*/
|
|
48871
48837
|
flow?: Record<string, unknown>;
|
|
48872
48838
|
/** Registered-flow name key for the runtime lane (`flowName ?? flowId`). */
|
|
@@ -49014,10 +48980,9 @@ interface RuntimeFlowToolConfig {
|
|
|
49014
48980
|
flowId?: string;
|
|
49015
48981
|
toolId?: string;
|
|
49016
48982
|
/**
|
|
49017
|
-
* Inline flow definition.
|
|
49018
|
-
*
|
|
49019
|
-
*
|
|
49020
|
-
* reference.
|
|
48983
|
+
* Inline flow definition. Agent dispatches support this — every eligible
|
|
48984
|
+
* agent runs on the runtime lane, which resolves an inline flow — while
|
|
48985
|
+
* hosted flow definitions currently require a `flowId`/`toolId` reference.
|
|
49021
48986
|
*/
|
|
49022
48987
|
flow?: Record<string, unknown>;
|
|
49023
48988
|
/** Registered-flow name key for the runtime lane (`flowName ?? flowId`). */
|
|
@@ -49585,32 +49550,6 @@ interface BillingSpendAnalyticsParams {
|
|
|
49585
49550
|
period?: 'billing_period' | 'current_month' | 'last_7_days' | 'last_30_days' | 'last_90_days';
|
|
49586
49551
|
}
|
|
49587
49552
|
|
|
49588
|
-
/**
|
|
49589
|
-
* Eval config-as-code: `defineEval` + the grader builders.
|
|
49590
|
-
*
|
|
49591
|
-
* The authoring layer for code-colocated evals — define the evals for a flow or
|
|
49592
|
-
* agent right next to its `defineFlow` / `flows.ensure` definition. This module
|
|
49593
|
-
* is PURE and local (no I/O), the exact analog of `defineFlow` in
|
|
49594
|
-
* `flows-ensure.ts`: it validates and normalizes a loose `DefineEvalInput` into
|
|
49595
|
-
* a canonical `EvalDefinition` (target + cases + per-case graders) and computes
|
|
49596
|
-
* a content hash for hash-first convergence. The converge motion
|
|
49597
|
-
* (`client.evals.ensure` → `POST /eval/ensure`) and the `runtype eval` CLI build
|
|
49598
|
-
* on this contract in later increments.
|
|
49599
|
-
*
|
|
49600
|
-
* Grader types are MIRRORED INLINE from `@runtypelabs/shared`'s
|
|
49601
|
-
* `grader-types.ts` (the SDK is dependency-free by convention — see the same
|
|
49602
|
-
* pattern in `flows-ensure.ts`). The wire shapes must stay byte-identical to the
|
|
49603
|
-
* shared discriminated union so an eval authored here scores through the existing
|
|
49604
|
-
* `EvalScoringService` unchanged.
|
|
49605
|
-
*
|
|
49606
|
-
* Scope: the output + AI-judge union plus the trace graders (`called_tool` /
|
|
49607
|
-
* `tool_order` / `ran_step` / `completed` / `cost` / …), each scored server-side
|
|
49608
|
-
* by the same pure `runCheck` engine over the run's captured execution trace.
|
|
49609
|
-
* Severity (`.gate()` / `.soft()`) is deliberately NOT emitted here — it lands
|
|
49610
|
-
* with its own grader-engine extension. See
|
|
49611
|
-
* `docs/features/planning/2026-06-24-code-colocated-evals.md`.
|
|
49612
|
-
*/
|
|
49613
|
-
|
|
49614
49553
|
/**
|
|
49615
49554
|
* Per-grader severity (mirror of `@runtypelabs/shared`'s `GraderSeverity`). A
|
|
49616
49555
|
* `gate` miss always fails the case; a `soft` miss is tracked-but-not-failing
|
|
@@ -50151,44 +50090,6 @@ declare function pullEval(client: RuntypeClient$1, name: string): Promise<EvalPu
|
|
|
50151
50090
|
*/
|
|
50152
50091
|
declare function runEvalSuite(client: RuntypeClient$1, input: RunEvalInput): Promise<RunEvalResult>;
|
|
50153
50092
|
|
|
50154
|
-
/**
|
|
50155
|
-
* Flow config-as-code: `defineFlow`, `flows.ensure`, `flows.pull`.
|
|
50156
|
-
*
|
|
50157
|
-
* The non-executing sibling of `flows.upsert()` — `upsert` is the
|
|
50158
|
-
* dispatch-coupled save-and-run motion (it saves the flow AND executes it in
|
|
50159
|
-
* one request); `ensure` is the deploy-time convergence postcondition: "make
|
|
50160
|
-
* the platform's definition of this flow match this object; no-op if it
|
|
50161
|
-
* already does." Identity is name + account scope (the API key's org, else
|
|
50162
|
-
* personal); environment is whichever API the client points at. `ensure`
|
|
50163
|
-
* never deletes, and renaming a definition orphans the old flow and creates a
|
|
50164
|
-
* new one.
|
|
50165
|
-
*
|
|
50166
|
-
* Wire protocol (POST /v1/flows/ensure — APQ-shaped, both APQ scars fixed):
|
|
50167
|
-
* 1. Hash-only probe `{ name, contentHash }`. A match is
|
|
50168
|
-
* `{ result: 'unchanged' }`; a miss is a NORMAL 200
|
|
50169
|
-
* `{ result: 'definitionRequired' }`, never an error.
|
|
50170
|
-
* 2. On a miss, retry with the full `definition`. The server recomputes the
|
|
50171
|
-
* canonical hash itself and returns it on every response — this SDK
|
|
50172
|
-
* echoes the server's hash (memoized per client instance) rather than
|
|
50173
|
-
* trusting its own serialization.
|
|
50174
|
-
*
|
|
50175
|
-
* The content hash is the SAME steps-only hash the flow upsert protocol uses
|
|
50176
|
-
* (`computeFlowContentHash` — mirrored from
|
|
50177
|
-
* `packages/shared/src/utils/flow-content-hash.ts`; this package is
|
|
50178
|
-
* dependency-free by convention), so ensure and upsert interoperate on the
|
|
50179
|
-
* same flow. The flow definition surface is `{ name, steps }` — description
|
|
50180
|
-
* is not part of the v1 ensure surface (the shared hash covers steps only).
|
|
50181
|
-
*
|
|
50182
|
-
* A `defineFlow` may also carry inline `evals` — eval suites to converge
|
|
50183
|
-
* alongside the flow. These are SDK-orchestrated: they are NOT part of the
|
|
50184
|
-
* flow content hash and NEVER ride the `/flows/ensure` wire (its server schema
|
|
50185
|
-
* is `.strict()` `{ name, steps }`). After the flow converges, `ensureFlow`
|
|
50186
|
-
* converges each inline suite through the existing `/eval/ensure` endpoint
|
|
50187
|
-
* (`ensureEval`), so eval semantics stay confined to the eval endpoints.
|
|
50188
|
-
*
|
|
50189
|
-
* See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
|
|
50190
|
-
*/
|
|
50191
|
-
|
|
50192
50093
|
/** SHA-256 (hex) over the canonical normalized step list (steps only). */
|
|
50193
50094
|
declare function computeFlowContentHash(steps: unknown[]): Promise<string>;
|
|
50194
50095
|
/**
|
|
@@ -50340,15 +50241,6 @@ declare class FlowDriftError extends Error {
|
|
|
50340
50241
|
constructor(plan: EnsureFlowPlan);
|
|
50341
50242
|
}
|
|
50342
50243
|
|
|
50343
|
-
/**
|
|
50344
|
-
* FlowsNamespace - Static namespace for flow operations
|
|
50345
|
-
*
|
|
50346
|
-
* Provides factory methods for creating flow builders with different modes:
|
|
50347
|
-
* - upsert: Create or update a flow by name
|
|
50348
|
-
* - virtual: One-off execution without saving
|
|
50349
|
-
* - use: Execute an existing flow by ID
|
|
50350
|
-
*/
|
|
50351
|
-
|
|
50352
50244
|
interface LocalToolsOptions {
|
|
50353
50245
|
localTools?: Record<string, (args: unknown) => Promise<unknown>>;
|
|
50354
50246
|
}
|
|
@@ -50726,13 +50618,6 @@ declare class RuntypeFlowBuilder {
|
|
|
50726
50618
|
private addStep;
|
|
50727
50619
|
}
|
|
50728
50620
|
|
|
50729
|
-
/**
|
|
50730
|
-
* BatchesNamespace - Static namespace for batch operations
|
|
50731
|
-
*
|
|
50732
|
-
* Provides direct methods for scheduling and managing batch operations.
|
|
50733
|
-
* Batches are always asynchronous - they don't return results immediately.
|
|
50734
|
-
*/
|
|
50735
|
-
|
|
50736
50621
|
interface BatchScheduleConfig {
|
|
50737
50622
|
/** Flow ID to execute for each record */
|
|
50738
50623
|
flowId: string;
|
|
@@ -50858,17 +50743,6 @@ declare class BatchesNamespace {
|
|
|
50858
50743
|
}>;
|
|
50859
50744
|
}
|
|
50860
50745
|
|
|
50861
|
-
/**
|
|
50862
|
-
* Eval-suite CRUD + case management + run — the SDK surface for the
|
|
50863
|
-
* `/v1/eval/suites` REST family (Beginner-First Evals).
|
|
50864
|
-
*
|
|
50865
|
-
* This is the imperative, id-addressed counterpart of the config-as-code
|
|
50866
|
-
* surface in `evals-ensure.ts` (`defineEval` / `ensure` / `pull`): use ensure
|
|
50867
|
-
* to converge a repo-authored suite on deploy, and this namespace to inspect
|
|
50868
|
-
* or manage suites, edit test cases (server-authoritative data), and start
|
|
50869
|
-
* runs. Exposed as `client.evals.suites.*`.
|
|
50870
|
-
*/
|
|
50871
|
-
|
|
50872
50746
|
/** The most recent run of a suite, with its score once graded. */
|
|
50873
50747
|
interface EvalSuiteLatestRun {
|
|
50874
50748
|
runId: string;
|
|
@@ -51257,13 +51131,6 @@ declare class EvalSuitesNamespace {
|
|
|
51257
51131
|
getCoverage(suiteId: string): Promise<EvalSuiteCoverage>;
|
|
51258
51132
|
}
|
|
51259
51133
|
|
|
51260
|
-
/**
|
|
51261
|
-
* EvalsNamespace - Static namespace for evaluation operations
|
|
51262
|
-
*
|
|
51263
|
-
* Provides methods for running evaluations and comparing model performance.
|
|
51264
|
-
* Evals can be streamed for real-time results or submitted as batch jobs.
|
|
51265
|
-
*/
|
|
51266
|
-
|
|
51267
51134
|
interface ModelOverride$1 {
|
|
51268
51135
|
/** Name of the step to override */
|
|
51269
51136
|
stepName: string;
|
|
@@ -51581,13 +51448,6 @@ declare class EvalsNamespace {
|
|
|
51581
51448
|
}>;
|
|
51582
51449
|
}
|
|
51583
51450
|
|
|
51584
|
-
/**
|
|
51585
|
-
* PromptsNamespace - Static namespace for prompt operations
|
|
51586
|
-
*
|
|
51587
|
-
* Provides CRUD operations for prompts and execution methods
|
|
51588
|
-
* with streaming and non-streaming options.
|
|
51589
|
-
*/
|
|
51590
|
-
|
|
51591
51451
|
interface CreatePromptData {
|
|
51592
51452
|
/** Prompt name */
|
|
51593
51453
|
name: string;
|
|
@@ -51749,39 +51609,6 @@ declare class PromptsNamespace {
|
|
|
51749
51609
|
delete(promptId: string): Promise<void>;
|
|
51750
51610
|
}
|
|
51751
51611
|
|
|
51752
|
-
/**
|
|
51753
|
-
* Skill config-as-code: `defineSkill`, `skills.ensure`, `skills.pull`.
|
|
51754
|
-
*
|
|
51755
|
-
* The deploy-time convergence postcondition for Agent Skills: "make the
|
|
51756
|
-
* platform's definition of this skill match this manifest; no-op if it already
|
|
51757
|
-
* does." Identity is name + account scope (the API key's org, else personal);
|
|
51758
|
-
* environment is whichever API the client points at. `ensure` never deletes,
|
|
51759
|
-
* and renaming a manifest orphans the old skill and creates a new one.
|
|
51760
|
-
*
|
|
51761
|
-
* This is the admin/control-plane converge — API scopes only, no review queue.
|
|
51762
|
-
* It is NOT the deployed-agent `propose_skill` data plane.
|
|
51763
|
-
*
|
|
51764
|
-
* Wire protocol (POST /v1/skills/ensure — APQ-shaped, both APQ scars fixed):
|
|
51765
|
-
* 1. Hash-only probe `{ name, contentHash }`. A match is
|
|
51766
|
-
* `{ result: 'unchanged' }`; a miss is a NORMAL 200
|
|
51767
|
-
* `{ result: 'definitionRequired' }`, never an error.
|
|
51768
|
-
* 2. On a miss, retry with the full `definition`. The server recomputes the
|
|
51769
|
-
* canonical hash itself and returns it on every response — this SDK echoes
|
|
51770
|
-
* the server's hash (memoized per client instance) rather than trusting its
|
|
51771
|
-
* own serialization.
|
|
51772
|
-
*
|
|
51773
|
-
* Like agents/flows (and unlike tools), skills HAVE version snapshots: every
|
|
51774
|
-
* change appends an immutable version, the result carries a `versionId`, and
|
|
51775
|
-
* `release: 'publish'` re-aims the published-version pointer.
|
|
51776
|
-
*
|
|
51777
|
-
* The content hash is the canonical skill hash (`computeSkillContentHash` —
|
|
51778
|
-
* mirrored from `packages/shared/src/utils/skill-content-hash.ts`; this package
|
|
51779
|
-
* is dependency-free by convention) over the manifest `{ frontmatter (name
|
|
51780
|
-
* excluded), runtype, body }`. `name` is identity, not content.
|
|
51781
|
-
*
|
|
51782
|
-
* See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
|
|
51783
|
-
*/
|
|
51784
|
-
|
|
51785
51612
|
interface SkillContentInput {
|
|
51786
51613
|
/** Identity — excluded from the hash. */
|
|
51787
51614
|
name: string;
|
|
@@ -51887,22 +51714,6 @@ declare class SkillDriftError extends Error {
|
|
|
51887
51714
|
constructor(plan: EnsureSkillPlan);
|
|
51888
51715
|
}
|
|
51889
51716
|
|
|
51890
|
-
/**
|
|
51891
|
-
* SkillsNamespace — admin/control-plane operations for Agent Skills.
|
|
51892
|
-
*
|
|
51893
|
-
* Skills are loadable context bundles (SKILL.md + capability bindings) for
|
|
51894
|
-
* deployed Runtype agents. This namespace wraps the admin REST surface
|
|
51895
|
-
* (`/v1/skills`, `/v1/skill-proposals`) — governed by API scopes only, no
|
|
51896
|
-
* review queue. The deployed-agent data plane (the `propose_skill` runtime
|
|
51897
|
-
* tool) is intentionally NOT exposed here; authoring a skill via the SDK is
|
|
51898
|
-
* authoring, and lands published when you ask it to.
|
|
51899
|
-
*
|
|
51900
|
-
* Types here mirror the canonical definitions in `@runtypelabs/shared`
|
|
51901
|
-
* (`skill-manifest-types.ts`) and the `skills` / `skill_versions` /
|
|
51902
|
-
* `agent_skill_bindings` / `skill_proposals` tables. Per SDK convention they
|
|
51903
|
-
* are defined inline rather than imported, to keep the package dependency-free.
|
|
51904
|
-
*/
|
|
51905
|
-
|
|
51906
51717
|
/** Lifecycle status of a skill. */
|
|
51907
51718
|
type SkillStatus = 'draft' | 'active' | 'archived';
|
|
51908
51719
|
/** Trust level recorded on a skill (governs UI warnings). */
|
|
@@ -52299,35 +52110,6 @@ declare class SkillsNamespace {
|
|
|
52299
52110
|
pull(name: string): Promise<SkillPullResult>;
|
|
52300
52111
|
}
|
|
52301
52112
|
|
|
52302
|
-
/**
|
|
52303
|
-
* AgentsNamespace — agent config-as-code: `defineAgent`, `ensure`, `pull`.
|
|
52304
|
-
*
|
|
52305
|
-
* `ensure` is a convergence postcondition, not a save button: "make the
|
|
52306
|
-
* platform's definition of this agent match this object; no-op if it already
|
|
52307
|
-
* does." Identity is name + account scope (the API key's org, else personal);
|
|
52308
|
-
* environment is whichever API the client points at. `ensure` never deletes,
|
|
52309
|
-
* and renaming a definition orphans the old agent and creates a new one.
|
|
52310
|
-
*
|
|
52311
|
-
* Wire protocol (POST /v1/agents/ensure — APQ-shaped, both APQ scars fixed):
|
|
52312
|
-
* 1. Hash-only probe `{ name, contentHash }`. A match is
|
|
52313
|
-
* `{ result: 'unchanged' }`; a miss is a NORMAL 200
|
|
52314
|
-
* `{ result: 'definitionRequired' }`, never an error.
|
|
52315
|
-
* 2. On a miss, retry with the full `definition`. The server recomputes the
|
|
52316
|
-
* canonical hash itself and returns it on every response — this SDK
|
|
52317
|
-
* echoes the server's hash (memoized per client instance) rather than
|
|
52318
|
-
* trusting its own serialization.
|
|
52319
|
-
*
|
|
52320
|
-
* The content-hash implementation below is an INLINED COPY of
|
|
52321
|
-
* `packages/shared/src/utils/agent-content-hash.ts` (this package is
|
|
52322
|
-
* dependency-free by convention, mirroring the flow content hash in
|
|
52323
|
-
* flows-namespace.ts). Parity is pinned by the shared fixture corpus in
|
|
52324
|
-
* `packages/shared/test-fixtures/agent-content-hash/cases.json`, asserted by
|
|
52325
|
-
* both packages' test suites. Change both copies (and regenerate the corpus)
|
|
52326
|
-
* in the same PR.
|
|
52327
|
-
*
|
|
52328
|
-
* See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
|
|
52329
|
-
*/
|
|
52330
|
-
|
|
52331
52113
|
/** Canonical normalized form — must stay byte-identical to the shared impl. */
|
|
52332
52114
|
declare function normalizeAgentDefinition(definition: {
|
|
52333
52115
|
name: string;
|
|
@@ -52567,36 +52349,6 @@ declare class ExecutionsNamespace {
|
|
|
52567
52349
|
getStatus(executionId: string): Promise<AsyncExecutionStatus>;
|
|
52568
52350
|
}
|
|
52569
52351
|
|
|
52570
|
-
/**
|
|
52571
|
-
* Tool config-as-code: `defineTool`, `tools.ensure`, `tools.pull`.
|
|
52572
|
-
*
|
|
52573
|
-
* The deploy-time convergence postcondition for saved tools: "make the
|
|
52574
|
-
* platform's definition of this tool match this object; no-op if it already
|
|
52575
|
-
* does." Identity is name + account scope (the API key's org, else personal);
|
|
52576
|
-
* environment is whichever API the client points at. `ensure` never deletes,
|
|
52577
|
-
* and renaming a definition orphans the old tool and creates a new one.
|
|
52578
|
-
*
|
|
52579
|
-
* Wire protocol (POST /v1/tools/ensure — APQ-shaped, both APQ scars fixed):
|
|
52580
|
-
* 1. Hash-only probe `{ name, contentHash }`. A match is
|
|
52581
|
-
* `{ result: 'unchanged' }`; a miss is a NORMAL 200
|
|
52582
|
-
* `{ result: 'definitionRequired' }`, never an error.
|
|
52583
|
-
* 2. On a miss, retry with the full `definition`. The server recomputes the
|
|
52584
|
-
* canonical hash itself and returns it on every response — this SDK
|
|
52585
|
-
* echoes the server's hash (memoized per client instance) rather than
|
|
52586
|
-
* trusting its own serialization.
|
|
52587
|
-
*
|
|
52588
|
-
* Unlike agents/flows, tools have NO version snapshots: there is no
|
|
52589
|
-
* `release: 'publish'` option and no `versionId` on the result.
|
|
52590
|
-
*
|
|
52591
|
-
* The content hash is the canonical tool hash (`computeToolContentHash` —
|
|
52592
|
-
* mirrored from `packages/shared/src/utils/tool-content-hash.ts`; this package
|
|
52593
|
-
* is dependency-free by convention) over `{ toolType, description,
|
|
52594
|
-
* parametersSchema, config }`. `name` is identity, not content, so it is
|
|
52595
|
-
* excluded from the hash.
|
|
52596
|
-
*
|
|
52597
|
-
* See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
|
|
52598
|
-
*/
|
|
52599
|
-
|
|
52600
52352
|
/** Canonical normalized form of a tool definition (name excluded — identity). */
|
|
52601
52353
|
declare function normalizeToolDefinition(definition: ToolContentInput): {
|
|
52602
52354
|
toolType: string;
|
|
@@ -52710,14 +52462,6 @@ declare class ToolDriftError extends Error {
|
|
|
52710
52462
|
constructor(plan: EnsureToolPlan);
|
|
52711
52463
|
}
|
|
52712
52464
|
|
|
52713
|
-
/**
|
|
52714
|
-
* ToolsNamespace — config-as-code operations for saved tools.
|
|
52715
|
-
*
|
|
52716
|
-
* `tools.ensure` is the deploy-time, non-executing converge (create-or-update a
|
|
52717
|
-
* tool by name + account scope); `tools.pull` is the absorb-drift direction.
|
|
52718
|
-
* Both delegate to the implementation in `tools-ensure.ts`.
|
|
52719
|
-
*/
|
|
52720
|
-
|
|
52721
52465
|
declare class ToolsNamespace {
|
|
52722
52466
|
private getClient;
|
|
52723
52467
|
constructor(getClient: () => RuntypeClient$1);
|
|
@@ -52751,42 +52495,6 @@ declare class ToolsNamespace {
|
|
|
52751
52495
|
pull(name: string): Promise<ToolPullResult>;
|
|
52752
52496
|
}
|
|
52753
52497
|
|
|
52754
|
-
/**
|
|
52755
|
-
* Product config-as-code: `defineProduct`, `products.ensure`, `products.pull`.
|
|
52756
|
-
*
|
|
52757
|
-
* The deploy-time convergence postcondition for the top-level product record:
|
|
52758
|
-
* "make the platform's definition of this product match this object; no-op if
|
|
52759
|
-
* it already does." Identity is name + account scope (the API key's org, else
|
|
52760
|
-
* personal); environment is whichever API the client points at. `ensure` never
|
|
52761
|
-
* deletes, and renaming a definition orphans the old product and creates a new
|
|
52762
|
-
* one.
|
|
52763
|
-
*
|
|
52764
|
-
* SCOPE (v1): the converge covers the TOP-LEVEL product record only — name
|
|
52765
|
-
* (identity), description, icon, and the `spec` (ProductSpec). It does NOT
|
|
52766
|
-
* converge nested capabilities/surfaces/tools/records/schedules, and it does
|
|
52767
|
-
* NOT converge `canvas` (architecture-viewer UI layout state).
|
|
52768
|
-
*
|
|
52769
|
-
* Wire protocol (POST /v1/products/ensure — APQ-shaped, both APQ scars fixed):
|
|
52770
|
-
* 1. Hash-only probe `{ name, contentHash }`. A match is
|
|
52771
|
-
* `{ result: 'unchanged' }`; a miss is a NORMAL 200
|
|
52772
|
-
* `{ result: 'definitionRequired' }`, never an error.
|
|
52773
|
-
* 2. On a miss, retry with the full `definition`. The server recomputes the
|
|
52774
|
-
* canonical hash itself and returns it on every response — this SDK
|
|
52775
|
-
* echoes the server's hash (memoized per client instance) rather than
|
|
52776
|
-
* trusting its own serialization.
|
|
52777
|
-
*
|
|
52778
|
-
* Unlike agents/flows, products have NO version snapshots: there is no
|
|
52779
|
-
* `release: 'publish'` option and no `versionId` on the result.
|
|
52780
|
-
*
|
|
52781
|
-
* The content hash is the canonical product hash (`computeProductContentHash` —
|
|
52782
|
-
* mirrored from `packages/shared/src/utils/product-content-hash.ts`; this
|
|
52783
|
-
* package is dependency-free by convention) over `{ description, icon, spec }`.
|
|
52784
|
-
* `name` is identity, not content, so it is excluded from the hash; `canvas` is
|
|
52785
|
-
* UI state and is excluded too.
|
|
52786
|
-
*
|
|
52787
|
-
* See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
|
|
52788
|
-
*/
|
|
52789
|
-
|
|
52790
52498
|
/** Canonical normalized form of a product definition (name + canvas excluded). */
|
|
52791
52499
|
declare function normalizeProductDefinition(definition: ProductContentInput): {
|
|
52792
52500
|
description?: string;
|
|
@@ -52888,25 +52596,6 @@ declare class ProductDriftError extends Error {
|
|
|
52888
52596
|
constructor(plan: EnsureProductPlan);
|
|
52889
52597
|
}
|
|
52890
52598
|
|
|
52891
|
-
/**
|
|
52892
|
-
* SDK config-as-code converge for an entire Full Product Object (FPO).
|
|
52893
|
-
*
|
|
52894
|
-
* `products.ensureFpo` converges the whole nested product graph in one request
|
|
52895
|
-
* by POSTing the FPO to `POST /v1/products/ensure-fpo`, where the server fans
|
|
52896
|
-
* out to the per-entity ensure services. Unlike `products.ensure` (top-level
|
|
52897
|
-
* record only), there is no hash-only probe in this release: the full FPO is
|
|
52898
|
-
* always shipped and the server returns the canonical whole-FPO hash + a
|
|
52899
|
-
* per-entity report. (The hash-only fast-probe lands once the server persists a
|
|
52900
|
-
* per-product FPO hash — see the plan's PR3.)
|
|
52901
|
-
*
|
|
52902
|
-
* `computeFpoContentHash` is inlined here (the SDK avoids a `@runtypelabs/shared`
|
|
52903
|
-
* dependency) and pinned byte-for-byte against the canonical implementation by
|
|
52904
|
-
* the shared fixture corpus (`packages/shared/test-fixtures/fpo-content-hash/`)
|
|
52905
|
-
* asserted from BOTH packages. A normalization change in
|
|
52906
|
-
* `packages/shared/src/utils/fpo-content-hash.ts` MUST be mirrored here in the
|
|
52907
|
-
* same PR.
|
|
52908
|
-
*/
|
|
52909
|
-
|
|
52910
52599
|
/** An FPO for hashing/sending. Permissive — the server validates the rich contract. */
|
|
52911
52600
|
type FpoInput = Record<string, unknown>;
|
|
52912
52601
|
/**
|
|
@@ -52981,18 +52670,6 @@ declare function ensureFpo(client: RuntypeClient$1, fpo: FpoInput, options?: Ens
|
|
|
52981
52670
|
*/
|
|
52982
52671
|
declare function pullFpo(client: RuntypeClient$1, name: string): Promise<PullFpoResult>;
|
|
52983
52672
|
|
|
52984
|
-
/**
|
|
52985
|
-
* ProductsNamespace — config-as-code operations for products.
|
|
52986
|
-
*
|
|
52987
|
-
* `products.ensure` is the deploy-time, non-executing converge (create-or-update
|
|
52988
|
-
* a product by name + account scope); `products.pull` is the absorb-drift
|
|
52989
|
-
* direction. Both delegate to the implementation in `products-ensure.ts`.
|
|
52990
|
-
*
|
|
52991
|
-
* SCOPE (v1): the converge covers the top-level product record only
|
|
52992
|
-
* (description, icon, spec). Nested capabilities/surfaces/tools and the
|
|
52993
|
-
* `canvas` UI layout state are not converged.
|
|
52994
|
-
*/
|
|
52995
|
-
|
|
52996
52673
|
declare class ProductsNamespace {
|
|
52997
52674
|
private getClient;
|
|
52998
52675
|
constructor(getClient: () => RuntypeClient$1);
|
|
@@ -53059,38 +52736,6 @@ declare class ProductsNamespace {
|
|
|
53059
52736
|
pullFpo(name: string): Promise<PullFpoResult>;
|
|
53060
52737
|
}
|
|
53061
52738
|
|
|
53062
|
-
/**
|
|
53063
|
-
* Surface config-as-code: `defineSurface`, `surfaces.ensure`, `surfaces.pull`.
|
|
53064
|
-
*
|
|
53065
|
-
* The deploy-time convergence postcondition for product surfaces: "make the
|
|
53066
|
-
* platform's definition of this surface match this object; no-op if it already
|
|
53067
|
-
* does." Surfaces are PRODUCT-scoped: identity is (productId, name) — NOT
|
|
53068
|
-
* account scope. `ensure` never deletes, and renaming a definition orphans the
|
|
53069
|
-
* old surface and creates a new one.
|
|
53070
|
-
*
|
|
53071
|
-
* Wire protocol (POST /v1/products/{id}/surfaces/ensure — APQ-shaped, both APQ
|
|
53072
|
-
* scars fixed):
|
|
53073
|
-
* 1. Hash-only probe `{ name, contentHash }`. A match is
|
|
53074
|
-
* `{ result: 'unchanged' }`; a miss is a NORMAL 200
|
|
53075
|
-
* `{ result: 'definitionRequired' }`, never an error.
|
|
53076
|
-
* 2. On a miss, retry with the full `definition`. The server recomputes the
|
|
53077
|
-
* canonical hash itself and returns it on every response — this SDK echoes
|
|
53078
|
-
* the server's hash (memoized per client instance) rather than trusting
|
|
53079
|
-
* its own serialization.
|
|
53080
|
-
*
|
|
53081
|
-
* Unlike agents/flows, surfaces have NO version snapshots: there is no
|
|
53082
|
-
* `release: 'publish'` option and no `versionId` on the result.
|
|
53083
|
-
*
|
|
53084
|
-
* The content hash is the canonical surface hash (`computeSurfaceContentHash` —
|
|
53085
|
-
* mirrored from `packages/shared/src/utils/surface-content-hash.ts`; this
|
|
53086
|
-
* package is dependency-free by convention) over `{ type, behavior, status,
|
|
53087
|
-
* environment }`. `name` is identity, not content, so it is excluded; `inbound` /
|
|
53088
|
-
* `outbound` are also EXCLUDED — they carry sealed secrets that hash
|
|
53089
|
-
* non-deterministically against the stored row (see `normalizeSurfaceDefinition`).
|
|
53090
|
-
*
|
|
53091
|
-
* See docs/adr/0003-agent-config-as-code-ensure.md for the design rationale.
|
|
53092
|
-
*/
|
|
53093
|
-
|
|
53094
52739
|
/**
|
|
53095
52740
|
* Canonical normalized form of a surface definition (name excluded — identity).
|
|
53096
52741
|
* `inbound` / `outbound` are EXCLUDED — they carry sealed secrets that hash
|
|
@@ -53212,16 +52857,6 @@ declare class SurfaceDriftError extends Error {
|
|
|
53212
52857
|
constructor(plan: EnsureSurfacePlan);
|
|
53213
52858
|
}
|
|
53214
52859
|
|
|
53215
|
-
/**
|
|
53216
|
-
* SurfacesNamespace — config-as-code operations for product surfaces.
|
|
53217
|
-
*
|
|
53218
|
-
* `surfaces.ensure` is the deploy-time, non-executing converge (create-or-update
|
|
53219
|
-
* a surface by name within a product); `surfaces.pull` is the absorb-drift
|
|
53220
|
-
* direction. Both delegate to the implementation in `surfaces-ensure.ts`.
|
|
53221
|
-
*
|
|
53222
|
-
* Surfaces are PRODUCT-scoped: every operation takes the owning `productId`.
|
|
53223
|
-
*/
|
|
53224
|
-
|
|
53225
52860
|
declare class SurfacesNamespace {
|
|
53226
52861
|
private getClient;
|
|
53227
52862
|
constructor(getClient: () => RuntypeClient$1);
|
|
@@ -53254,49 +52889,6 @@ declare class SurfacesNamespace {
|
|
|
53254
52889
|
pull(productId: string, name: string): Promise<SurfacePullResult>;
|
|
53255
52890
|
}
|
|
53256
52891
|
|
|
53257
|
-
/**
|
|
53258
|
-
* Runtype - The unified SDK client for building and executing flows, batches, evals, and prompts
|
|
53259
|
-
*
|
|
53260
|
-
* Provides a fluent API with static namespaces for all product areas.
|
|
53261
|
-
*
|
|
53262
|
-
* @example
|
|
53263
|
-
* ```typescript
|
|
53264
|
-
* import { Runtype } from '@runtypelabs/sdk'
|
|
53265
|
-
*
|
|
53266
|
-
* // Global configuration (once per app)
|
|
53267
|
-
* Runtype.configure({ apiKey: process.env.RUNTYPE_API_KEY })
|
|
53268
|
-
*
|
|
53269
|
-
* // Build and stream a flow
|
|
53270
|
-
* const stream = await Runtype.flows.upsert({ name: 'My Flow' })
|
|
53271
|
-
* .withRecord({ name: 'Test', metadata: {} })
|
|
53272
|
-
* .prompt({ name: 'Analyze', model: 'gpt-4o', userPrompt: '...' })
|
|
53273
|
-
* .stream()
|
|
53274
|
-
*
|
|
53275
|
-
* // Get complete result
|
|
53276
|
-
* const result = await Runtype.flows.use('flow_123')
|
|
53277
|
-
* .withRecord({ name: 'Test' })
|
|
53278
|
-
* .result()
|
|
53279
|
-
*
|
|
53280
|
-
* // Schedule a batch
|
|
53281
|
-
* const batch = await Runtype.batches.schedule({
|
|
53282
|
-
* flowId: 'flow_123',
|
|
53283
|
-
* recordType: 'customers',
|
|
53284
|
-
* })
|
|
53285
|
-
*
|
|
53286
|
-
* // Run an eval with streaming
|
|
53287
|
-
* const evalStream = await Runtype.evals.run({
|
|
53288
|
-
* flowId: 'flow_123',
|
|
53289
|
-
* recordType: 'test_data',
|
|
53290
|
-
* models: [{ stepName: 'Analyze', model: 'gpt-4o' }]
|
|
53291
|
-
* }).stream()
|
|
53292
|
-
*
|
|
53293
|
-
* // Execute a prompt
|
|
53294
|
-
* const promptResult = await Runtype.prompts.run('prompt_123', {
|
|
53295
|
-
* recordId: 'rec_456'
|
|
53296
|
-
* }).result()
|
|
53297
|
-
* ```
|
|
53298
|
-
*/
|
|
53299
|
-
|
|
53300
52892
|
interface RuntypeConfig {
|
|
53301
52893
|
/** API key for authentication */
|
|
53302
52894
|
apiKey?: string;
|
|
@@ -53384,9 +52976,46 @@ declare class RuntypeClient$1 {
|
|
|
53384
52976
|
private transformResponse;
|
|
53385
52977
|
}
|
|
53386
52978
|
/**
|
|
53387
|
-
* Runtype -
|
|
52979
|
+
* Runtype - The unified SDK client for building and executing flows, batches, evals, and prompts.
|
|
52980
|
+
*
|
|
52981
|
+
* Provides a fluent API with static namespaces for all product areas.
|
|
53388
52982
|
*
|
|
53389
|
-
*
|
|
52983
|
+
* @example
|
|
52984
|
+
* ```typescript
|
|
52985
|
+
* import { Runtype } from '@runtypelabs/sdk'
|
|
52986
|
+
*
|
|
52987
|
+
* // Global configuration (once per app)
|
|
52988
|
+
* Runtype.configure({ apiKey: process.env.RUNTYPE_API_KEY })
|
|
52989
|
+
*
|
|
52990
|
+
* // Build and stream a flow
|
|
52991
|
+
* const stream = await Runtype.flows.upsert({ name: 'My Flow' })
|
|
52992
|
+
* .withRecord({ name: 'Test', metadata: {} })
|
|
52993
|
+
* .prompt({ name: 'Analyze', model: 'gpt-4o', userPrompt: '...' })
|
|
52994
|
+
* .stream()
|
|
52995
|
+
*
|
|
52996
|
+
* // Get complete result
|
|
52997
|
+
* const result = await Runtype.flows.use('flow_123')
|
|
52998
|
+
* .withRecord({ name: 'Test' })
|
|
52999
|
+
* .result()
|
|
53000
|
+
*
|
|
53001
|
+
* // Schedule a batch
|
|
53002
|
+
* const batch = await Runtype.batches.schedule({
|
|
53003
|
+
* flowId: 'flow_123',
|
|
53004
|
+
* recordType: 'customers',
|
|
53005
|
+
* })
|
|
53006
|
+
*
|
|
53007
|
+
* // Run an eval with streaming
|
|
53008
|
+
* const evalStream = await Runtype.evals.run({
|
|
53009
|
+
* flowId: 'flow_123',
|
|
53010
|
+
* recordType: 'test_data',
|
|
53011
|
+
* models: [{ stepName: 'Analyze', model: 'gpt-4o' }]
|
|
53012
|
+
* }).stream()
|
|
53013
|
+
*
|
|
53014
|
+
* // Execute a prompt
|
|
53015
|
+
* const promptResult = await Runtype.prompts.run('prompt_123', {
|
|
53016
|
+
* recordId: 'rec_456'
|
|
53017
|
+
* }).result()
|
|
53018
|
+
* ```
|
|
53390
53019
|
*/
|
|
53391
53020
|
declare class Runtype {
|
|
53392
53021
|
/**
|
|
@@ -54168,15 +53797,6 @@ type TypedCreateRecordRequest<S extends string> = Omit<CreateRecordRequest, 'typ
|
|
|
54168
53797
|
metadata?: CollectionMeta<S>;
|
|
54169
53798
|
};
|
|
54170
53799
|
|
|
54171
|
-
/**
|
|
54172
|
-
* Pluggable workflow architecture for marathon task execution.
|
|
54173
|
-
*
|
|
54174
|
-
* A WorkflowDefinition describes the phases an agent goes through
|
|
54175
|
-
* (e.g. research → planning → execution) and the rules for each phase.
|
|
54176
|
-
* The default implementation mirrors the existing hardcoded behavior;
|
|
54177
|
-
* consumers can supply custom workflows for different strategies (TDD, etc.).
|
|
54178
|
-
*/
|
|
54179
|
-
|
|
54180
53800
|
interface RunTaskStateSlice {
|
|
54181
53801
|
agentId: string;
|
|
54182
53802
|
taskName: string;
|
|
@@ -54318,10 +53938,6 @@ interface WorkflowDefinition {
|
|
|
54318
53938
|
buildCandidateBlock?: (state: RunTaskStateSlice) => string;
|
|
54319
53939
|
}
|
|
54320
53940
|
|
|
54321
|
-
/**
|
|
54322
|
-
* API endpoint handlers with automatic camelCase/snake_case transformation
|
|
54323
|
-
*/
|
|
54324
|
-
|
|
54325
53941
|
interface ApiClient {
|
|
54326
53942
|
get<T>(path: string, params?: {
|
|
54327
53943
|
[key: string]: any;
|
|
@@ -55537,7 +55153,7 @@ interface AgentMediaEvent extends BaseAgentEvent {
|
|
|
55537
55153
|
*
|
|
55538
55154
|
* Local SDK copy of `ExternalAgentContext` from `@runtypelabs/shared`'s
|
|
55539
55155
|
* `sse-parser.ts`. The SDK has zero production dependencies and
|
|
55540
|
-
* re-derives wire types by design (
|
|
55156
|
+
* re-derives wire types by design (see
|
|
55541
55157
|
* `docs/features/shipped/2026-02-25-user-cloud-deployment.md`). Keep
|
|
55542
55158
|
* the shape identical to `@runtypelabs/shared`'s `ExternalAgentContext`.
|
|
55543
55159
|
*/
|
|
@@ -55572,7 +55188,7 @@ interface AgentElicitationRequest {
|
|
|
55572
55188
|
*
|
|
55573
55189
|
* Local SDK copy of `unifiedElicitationSchema` from `@runtypelabs/shared`'s
|
|
55574
55190
|
* `unified-sse-event-schemas.ts`. The SDK has zero production dependencies and
|
|
55575
|
-
* re-derives wire types by design
|
|
55191
|
+
* re-derives wire types by design. Keep the shape identical.
|
|
55576
55192
|
*/
|
|
55577
55193
|
interface AgentElicitation {
|
|
55578
55194
|
/** `form` answers with text; `url` sends the human to {@link url} first. */
|
|
@@ -57111,18 +56727,6 @@ declare class ToolApprovalGrantsEndpoint {
|
|
|
57111
56727
|
}>;
|
|
57112
56728
|
}
|
|
57113
56729
|
|
|
57114
|
-
/**
|
|
57115
|
-
* @layer sdk
|
|
57116
|
-
* @case camelCase (SDK and API both use native camelCase - no conversion needed)
|
|
57117
|
-
*
|
|
57118
|
-
* Main Runtype API Client.
|
|
57119
|
-
*
|
|
57120
|
-
* The SDK and API both use native camelCase for all request/response bodies.
|
|
57121
|
-
* No case transformation is performed.
|
|
57122
|
-
*
|
|
57123
|
-
* @see packages/client/src/transform.ts for pass-through utilities
|
|
57124
|
-
*/
|
|
57125
|
-
|
|
57126
56730
|
type LocalToolHandler = (args: unknown) => Promise<unknown>;
|
|
57127
56731
|
/**
|
|
57128
56732
|
* Richer local tool entry that pairs a handler with the wire schema the
|
|
@@ -57404,44 +57008,6 @@ declare function parseOffloadedOutputId(value: string): string | undefined;
|
|
|
57404
57008
|
/** Parse the tree-log-relative artifact path out of a ledger offload reference. */
|
|
57405
57009
|
declare function parseLedgerArtifactRelativePath(value: string): string | undefined;
|
|
57406
57010
|
|
|
57407
|
-
/**
|
|
57408
|
-
* Unified wire → stable SDK callback adapter (the client-side mirror of the api's
|
|
57409
|
-
* `apps/api/src/lib/unified-event-stream.ts`).
|
|
57410
|
-
*
|
|
57411
|
-
* As of the unified-SSE cutover (runtypelabs/core unified-sse-default) the
|
|
57412
|
-
* execution streams the SDK consumes — `/dispatch`, `/dispatch/resume`,
|
|
57413
|
-
* `/agents/{id}/execute`, `/agents/{id}/resume` — use the 35-event unified
|
|
57414
|
-
* vocabulary (`unifiedSSEEventSchema` in `@runtypelabs/shared`). The SDK
|
|
57415
|
-
* translates those frames back into its stable, hand-written callback shapes
|
|
57416
|
-
* here.
|
|
57417
|
-
*
|
|
57418
|
-
* Why translate instead of rewriting every consumer switch: the SDK's public
|
|
57419
|
-
* callback contracts (`StreamCallbacks`, `AgentStreamCallbacks`) and their event
|
|
57420
|
-
* types are part of the published surface. Reversing the wire at the parse
|
|
57421
|
-
* boundary moves the SDK onto the unified format on the wire while keeping that
|
|
57422
|
-
* surface byte-stable for downstream consumers. The translation is the inverse
|
|
57423
|
-
* of the api edge translator's mapping table
|
|
57424
|
-
* (`docs/features/planning/2026-06-16-persona-sse-event-merged-spec.md`).
|
|
57425
|
-
*
|
|
57426
|
-
* Scope: only the events the SDK's consumers actually read are reconstructed;
|
|
57427
|
-
* everything else (artifact channel, `source`, the `state_snapshot` /
|
|
57428
|
-
* `state_delta` agent-state channel, `custom`, fallback live-beat, `step_skip`)
|
|
57429
|
-
* maps to zero callback events. The state channel is recognized as unified
|
|
57430
|
-
* vocabulary (so `isUnifiedEventType` is true and the wire union stays exhaustive)
|
|
57431
|
-
* but has no stable SDK callback shape to project onto; surfacing it to the SDK
|
|
57432
|
-
* callback surface is a separate additive slice, not a wire-translation concern.
|
|
57433
|
-
* Two unified-contract folds are NOT reconstructed because the unified
|
|
57434
|
-
* vocabulary deliberately discards them:
|
|
57435
|
-
* - `agent_iteration_start` / `agent_iteration_complete` are folded into the
|
|
57436
|
-
* `iteration` field on turn/tool frames, so `onIterationStart` /
|
|
57437
|
-
* `onIterationComplete` no longer fire.
|
|
57438
|
-
* - the additive `fallback` summary on `step_complete` / `turn_complete` is
|
|
57439
|
-
* dropped (the SDK callback surface never consumed `fallback_*` events).
|
|
57440
|
-
*
|
|
57441
|
-
* Each translator is STATEFUL (channel block ids, current step/turn/iteration,
|
|
57442
|
-
* media accumulation) and therefore must be constructed once PER STREAM — never
|
|
57443
|
-
* shared across executions.
|
|
57444
|
-
*/
|
|
57445
57011
|
type Json = Record<string, unknown>;
|
|
57446
57012
|
/**
|
|
57447
57013
|
* @deprecated Unified events are now the only public execution-stream format.
|
|
@@ -57587,41 +57153,6 @@ declare class ClientBatchBuilder extends BatchBuilder {
|
|
|
57587
57153
|
run(): Promise<BatchResult>;
|
|
57588
57154
|
}
|
|
57589
57155
|
|
|
57590
|
-
/**
|
|
57591
|
-
* EvalBuilder - Fluent builder for evaluation runs
|
|
57592
|
-
*
|
|
57593
|
-
* Provides a chainable API for building evaluation configurations
|
|
57594
|
-
* that test flows against records with model overrides and comparisons.
|
|
57595
|
-
*
|
|
57596
|
-
* @example
|
|
57597
|
-
* ```typescript
|
|
57598
|
-
* import { EvalBuilder } from '@runtypelabs/sdk'
|
|
57599
|
-
*
|
|
57600
|
-
* // Single model eval with overrides
|
|
57601
|
-
* const eval1 = await new EvalBuilder()
|
|
57602
|
-
* .useFlow('flow_abc123')
|
|
57603
|
-
* .forRecordType('test_data')
|
|
57604
|
-
* .withModelOverrides([{ stepName: 'Analyze', model: 'gpt-4o' }])
|
|
57605
|
-
* .run(apiClient)
|
|
57606
|
-
*
|
|
57607
|
-
* // Multi-model comparison
|
|
57608
|
-
* const eval2 = await new EvalBuilder()
|
|
57609
|
-
* .useFlow('flow_abc123')
|
|
57610
|
-
* .forRecordType('test_data')
|
|
57611
|
-
* .compareModels([
|
|
57612
|
-
* { stepName: 'Analyze', model: 'gpt-5.4' },
|
|
57613
|
-
* { stepName: 'Analyze', model: 'claude-opus-4-6' },
|
|
57614
|
-
* ])
|
|
57615
|
-
* .run(apiClient)
|
|
57616
|
-
*
|
|
57617
|
-
* // Virtual flow eval
|
|
57618
|
-
* const eval3 = await new EvalBuilder()
|
|
57619
|
-
* .useVirtualFlow(flowBuilder)
|
|
57620
|
-
* .forRecordType('test_data')
|
|
57621
|
-
* .run(apiClient)
|
|
57622
|
-
* ```
|
|
57623
|
-
*/
|
|
57624
|
-
|
|
57625
57156
|
interface ModelOverride {
|
|
57626
57157
|
/** Name of the step to override */
|
|
57627
57158
|
stepName: string;
|
|
@@ -57813,16 +57344,6 @@ declare class ClientEvalBuilder extends EvalBuilder {
|
|
|
57813
57344
|
run(): Promise<EvalResult>;
|
|
57814
57345
|
}
|
|
57815
57346
|
|
|
57816
|
-
/**
|
|
57817
|
-
* SDK Code Generation Metadata
|
|
57818
|
-
*
|
|
57819
|
-
* Type-safe field registry for generating SDK code from flow step configs.
|
|
57820
|
-
* Co-located with the step config interfaces so that adding or removing a
|
|
57821
|
-
* field on any config interface produces a compile error here, preventing
|
|
57822
|
-
* silent drift between the SDK and downstream code generators (e.g. the
|
|
57823
|
-
* dashboard's sdk-code-generator.ts).
|
|
57824
|
-
*/
|
|
57825
|
-
|
|
57826
57347
|
/** How to serialize a field value into TypeScript source code. */
|
|
57827
57348
|
type FieldFormat = 'json' | 'template' | 'raw' | 'value';
|
|
57828
57349
|
/** Describes one field in a step config for code emission. */
|
|
@@ -58538,20 +58059,6 @@ declare const STEP_TYPE_TO_METHOD: {
|
|
|
58538
58059
|
readonly 'memory-summary': "memorySummary";
|
|
58539
58060
|
};
|
|
58540
58061
|
|
|
58541
|
-
/**
|
|
58542
|
-
* Named workflow hook registry.
|
|
58543
|
-
*
|
|
58544
|
-
* Workflow configs (the data form compiled by `compileWorkflowConfig`) can
|
|
58545
|
-
* reference behavior by name instead of carrying functions: `builtin:*` names
|
|
58546
|
-
* are reserved for the hooks that power the default workflow, and consumers
|
|
58547
|
-
* register their own under a custom namespace (e.g. `acme:my-completion`).
|
|
58548
|
-
*
|
|
58549
|
-
* Every hook declares which SLOT KIND it implements so a config that wires a
|
|
58550
|
-
* hook into the wrong slot fails at load/compile time with an actionable
|
|
58551
|
-
* error — not mid-marathon. Hook misfires in this system don't crash, they
|
|
58552
|
-
* stall, which is the worst failure mode to debug.
|
|
58553
|
-
*/
|
|
58554
|
-
|
|
58555
58062
|
interface WorkflowHookSignatures {
|
|
58556
58063
|
/** WorkflowPhase.buildInstructions — used verbatim (no header is added) */
|
|
58557
58064
|
instructions: (state: RunTaskStateSlice) => string;
|
|
@@ -58605,27 +58112,6 @@ declare function listWorkflowHooks(): Array<{
|
|
|
58605
58112
|
/** Test seam: remove a custom hook (builtin entries cannot be removed). */
|
|
58606
58113
|
declare function unregisterWorkflowHook(name: string): boolean;
|
|
58607
58114
|
|
|
58608
|
-
/**
|
|
58609
|
-
* Declarative workflow configs and the compiler that turns them into a
|
|
58610
|
-
* `WorkflowDefinition`.
|
|
58611
|
-
*
|
|
58612
|
-
* This is the single compile path for marathon workflows-as-data: the CLI
|
|
58613
|
-
* playbook loader parses YAML/JSON into a `WorkflowConfig` and delegates here,
|
|
58614
|
-
* and the shipped default workflow is itself a `WorkflowConfig`
|
|
58615
|
-
* (`defaultWorkflowConfig` in default-workflow.ts) compiled through the same
|
|
58616
|
-
* function — so playbooks and the default cannot drift in semantics.
|
|
58617
|
-
*
|
|
58618
|
-
* Each behavior slot accepts either INLINE DATA (strings, declarative
|
|
58619
|
-
* criteria, policy rules) or a HOOK REFERENCE (`"<namespace>:<id>"`, see
|
|
58620
|
-
* hook-registry.ts) resolved against the registry with slot-kind validation
|
|
58621
|
-
* at compile time.
|
|
58622
|
-
*
|
|
58623
|
-
* The compiler is environment-free: no fs, no YAML, no glob library. Glob
|
|
58624
|
-
* matching for policy rules is injected via `WorkflowCompileDeps` (the CLI
|
|
58625
|
-
* passes micromatch); configs that use glob policies without a matcher fail
|
|
58626
|
-
* at compile time with an actionable error.
|
|
58627
|
-
*/
|
|
58628
|
-
|
|
58629
58115
|
declare const DEFAULT_RECOVERY_AFTER_EMPTY_SESSIONS = 2;
|
|
58630
58116
|
/** A `"<namespace>:<id>"` reference into the workflow hook registry. */
|
|
58631
58117
|
type WorkflowHookRef = string;
|
|
@@ -58770,14 +58256,6 @@ declare function buildPolicyGuidance(policy?: WorkflowPolicyConfig): string[];
|
|
|
58770
58256
|
*/
|
|
58771
58257
|
declare function compileWorkflowConfig(config: WorkflowConfig, deps?: WorkflowCompileDeps): WorkflowDefinition;
|
|
58772
58258
|
|
|
58773
|
-
/**
|
|
58774
|
-
* Default marathon workflow: research → planning → execution.
|
|
58775
|
-
*
|
|
58776
|
-
* This is a data-driven extraction of the previously hardcoded logic
|
|
58777
|
-
* in AgentsEndpoint. It handles both "modify" and "create" task variants
|
|
58778
|
-
* via the `workflowVariant` / `isCreationTask` flags on state.
|
|
58779
|
-
*/
|
|
58780
|
-
|
|
58781
58259
|
/**
|
|
58782
58260
|
* Register the default workflow's behaviors as `builtin:*` hooks. Idempotent.
|
|
58783
58261
|
* Importing this module (or anything that pulls in `defaultWorkflow`) calls it
|
|
@@ -58797,58 +58275,10 @@ declare function ensureDefaultWorkflowHooks(): void;
|
|
|
58797
58275
|
declare const defaultWorkflowConfig: WorkflowConfig;
|
|
58798
58276
|
declare const defaultWorkflow: WorkflowDefinition;
|
|
58799
58277
|
|
|
58800
|
-
/**
|
|
58801
|
-
* Deploy workflow: scaffold → deploy.
|
|
58802
|
-
*
|
|
58803
|
-
* A streamlined two-phase workflow for tasks where the goal is to build
|
|
58804
|
-
* code and deploy it to a sandbox with a live preview URL, rather than
|
|
58805
|
-
* editing files in the local repository.
|
|
58806
|
-
*
|
|
58807
|
-
* Phase 1 (scaffold): Understand what the user wants built. Quick —
|
|
58808
|
-
* auto-advances after the agent has acknowledged the task.
|
|
58809
|
-
*
|
|
58810
|
-
* Phase 2 (deploy): Write code and call deploy_sandbox to get a live
|
|
58811
|
-
* preview URL. Iterate on errors until the deployment succeeds.
|
|
58812
|
-
*/
|
|
58813
|
-
|
|
58814
58278
|
declare const deployWorkflow: WorkflowDefinition;
|
|
58815
58279
|
|
|
58816
|
-
/**
|
|
58817
|
-
* Game workflow: design → build → verify.
|
|
58818
|
-
*
|
|
58819
|
-
* A three-phase workflow for tasks where the goal is to build a game
|
|
58820
|
-
* (Three.js, Phaser, WebGL, etc.) and deploy it to a Daytona sandbox.
|
|
58821
|
-
*
|
|
58822
|
-
* The key difference from the deploy workflow is that game code often
|
|
58823
|
-
* uses template literals, which break when embedded inside Express
|
|
58824
|
-
* `res.send()` template literals. This workflow instructs the agent to
|
|
58825
|
-
* use the `files` parameter for multi-file deployment (Express static
|
|
58826
|
-
* server + separate HTML/JS/CSS files).
|
|
58827
|
-
*
|
|
58828
|
-
* Phase 1 (design): Understand game requirements. Auto-advances after
|
|
58829
|
-
* the first session.
|
|
58830
|
-
*
|
|
58831
|
-
* Phase 2 (build): Write game code using multi-file deployment. The
|
|
58832
|
-
* agent uses `code` for a minimal Express static server and `files`
|
|
58833
|
-
* for the actual game assets (HTML, JS, CSS).
|
|
58834
|
-
*
|
|
58835
|
-
* Phase 3 (verify): Confirm the game is running and playable. Auto-
|
|
58836
|
-
* accepts completion when deploy_sandbox has succeeded.
|
|
58837
|
-
*/
|
|
58838
|
-
|
|
58839
58280
|
declare const gameWorkflow: WorkflowDefinition;
|
|
58840
58281
|
|
|
58841
|
-
/**
|
|
58842
|
-
* Helpers for WorkflowDefinition.stallPolicy: what happens when an agent
|
|
58843
|
-
* produces consecutive sessions with no tool actions.
|
|
58844
|
-
*
|
|
58845
|
-
* All thresholds count the run-level `consecutiveEmptySessions` counter (a
|
|
58846
|
-
* session is empty when it performed no write/read/discovery/verification
|
|
58847
|
-
* tool action), so narration-only sessions escalate here even though they
|
|
58848
|
-
* carry text output. Absent policy values preserve the legacy behavior:
|
|
58849
|
-
* no nudge, no escalation signal, stop after 3.
|
|
58850
|
-
*/
|
|
58851
|
-
|
|
58852
58282
|
declare const DEFAULT_STALL_STOP_AFTER = 3;
|
|
58853
58283
|
/** Resolve how many consecutive empty sessions end the run as 'stalled'. */
|
|
58854
58284
|
declare function resolveStallStopAfter(policy?: WorkflowStallPolicy): number;
|