stitchkit 0.58.0 → 0.59.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.
@@ -1,11 +1,12 @@
1
1
  import type { ServiceDef, StitchLogger } from '../server/types';
2
2
  import { type CliCommandDefinition } from './cli-command';
3
3
  import { type ExitCodeMap } from './cli-format';
4
+ import { type CliPresentationPolicyConfig } from './cli-policy';
4
5
  import { type CliWaitConfig } from './cli-wait';
5
6
  import { type ErrorHintFn, type ToolCallHooks, type ToolLifecycle } from './execute';
6
7
  import type { RuntimeToolDefinition } from './runtime-tool';
7
8
  export type CliSurfaceSource<TAuth, TValue> = readonly TValue[] | ((auth: Awaited<TAuth> | undefined) => readonly TValue[]);
8
- export interface CliConfig<TAuth = unknown, TContext extends Record<string, unknown> = Record<string, unknown>> {
9
+ export interface CliConfig<TAuth = unknown, TContext extends Record<string, unknown> = Record<string, unknown>> extends CliPresentationPolicyConfig {
9
10
  /** Program name — shown in help and unknown-command messages. */
10
11
  name: string;
11
12
  /** Program version — printed by `--version`. */
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/tools/cli.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAOhE,OAAO,EACL,KAAK,oBAAoB,EAG1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAsB,KAAK,WAAW,EAAc,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,YAAY,CAAC;AAC/D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAGnB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAI5D,MAAM,MAAM,gBAAgB,CAAC,KAAK,EAAE,MAAM,IACtC,SAAS,MAAM,EAAE,GACjB,CAAC,CAAC,I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IAAI,CAAC;IAC9B,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACtC;AAmUD,8EAA8E;AAC9E,wBAAsB,SAAS,CAC7B,KAAK,GAAG,OAAO,EACf,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,MAAM,EAAE,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA+RnD"}
package/dist/tools.d.ts CHANGED
@@ -6,6 +6,7 @@ export { type AdaptedContractAsyncOperationConfig, type AdaptedContractAsyncOper
6
6
  export { type CliConfig, type CliSurfaceSource, createCli } from './tools/cli';
7
7
  export { type CliCommandContext, type CliCommandDefinition, type CliCommandDefinitionBase, type CliCommandDefinitionWithOutput, type CliCommandDefinitionWithoutOutput, defineCliCommand, } from './tools/cli-command';
8
8
  export type { ExitCodeMap } from './tools/cli-format';
9
+ export type { CliPresentationPolicyConfig } from './tools/cli-policy';
9
10
  export type { CliWaitConfig } from './tools/cli-wait';
10
11
  export { coerceJsonArgs } from './tools/coerce';
11
12
  export { type DefineDownloadToolConfig, defineDownloadTool, } from './tools/define-download-tool';
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,KAAK,mCAAmC,EACxC,KAAK,sCAAsC,EAC3C,KA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,EACpB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
package/dist/tools.js CHANGED
@@ -24,7 +24,7 @@ import {
24
24
  formatToolError,
25
25
  readCapped,
26
26
  runWaitOperation
27
- } from "./index-zk5zn2nh.js";
27
+ } from "./index-3nwng7hs.js";
28
28
  import {
29
29
  ToolExecutionControlError,
30
30
  coerceJsonArgs,
package/llms-full.txt CHANGED
@@ -3500,29 +3500,40 @@ provide one database transaction driver:
3500
3500
  ```ts
3501
3501
  const store = createAgentRuntimeStore({
3502
3502
  transaction: work => db.transaction(tx => work(tx)),
3503
- state: {
3504
- load: (tx, conversationId) => loadRuntimeState(tx, conversationId),
3505
- compareAndSwap: (tx, operation) => casRuntimeState(tx, operation),
3503
+ head: {
3504
+ load: (tx, conversationId) => loadRuntimeHead(tx, conversationId),
3505
+ compareAndSwap: (tx, operation) => casRuntimeHead(tx, operation),
3506
+ },
3507
+ runs: {
3508
+ load: (tx, identity) => loadRun(tx, identity),
3509
+ loadByAssistantMessageId: (tx, identity) => loadRunByAssistant(tx, identity),
3510
+ loadMany: (tx, identities) => loadRuns(tx, identities),
3511
+ listActive: (tx, conversationId) => listActiveRuns(tx, conversationId),
3512
+ save: (tx, record) => saveRun(tx, record),
3513
+ },
3514
+ admissions: {
3515
+ load: (tx, identity) => loadAdmission(tx, identity),
3516
+ loadByInputMessageId: (tx, identity) => loadAdmissionByInput(tx, identity),
3517
+ create: (tx, receipt) => createAdmission(tx, receipt),
3506
3518
  },
3507
3519
  history: {
3508
3520
  load: (tx, conversationId) => loadCanonicalMessages(tx, conversationId),
3509
- loadById: (tx, identity) => loadActiveOrArchivedMessage(tx, identity),
3510
3521
  apply: (tx, mutation) => applyCanonicalHistoryMutation(tx, mutation),
3511
3522
  },
3512
3523
  scanRecoverable: page => scanRecoverableRuns(page),
3513
3524
  })
3514
3525
  ```
3515
3526
 
3516
- The same opaque `tx` reaches state and history callbacks. The adapter maps rows
3527
+ The same opaque `tx` reaches head, run, admission and history callbacks. The adapter maps rows
3517
3528
  and supplies atomicity; Stitchkit owns transition validation and revision
3518
3529
  arithmetic. The executable reference is
3519
3530
  [`examples/agent-store-prisma/adapter.ts`](../../examples/agent-store-prisma/adapter.ts).
3520
3531
  `compareAndSwap` returns either `{ outcome: 'applied' }` or
3521
- `{ outcome: 'conflict', actualVersion }`; on a winning write it also persists the
3522
- framework-provided `recoverable` descriptors in the same transaction. Recovery
3523
- scans that bounded index instead of loading every aggregate. Compaction may hide
3524
- rows from `history.load`, but `history.loadById` must retain canonical admitted
3525
- inputs for durable duplicate receipts.
3532
+ `{ outcome: 'conflict', actualVersion }`. The head contains only schema version,
3533
+ conversation identity and monotonic version. Runs and admission receipts are normalized records;
3534
+ recovery queries active run states directly instead of maintaining a second projection.
3535
+ An admission receipt retains its canonical input, and a terminal run retains its canonical
3536
+ assistant, so physical product-history compaction cannot break idempotent retries.
3526
3537
 
3527
3538
  ## Durable order
3528
3539
 
@@ -3559,8 +3570,13 @@ Durably queued records rejected from the local queue remain recoverable through
3559
3570
 
3560
3571
  Use `await runtime.interrupt({ conversationId, runId })` when the interruption
3561
3572
  must be durable: it first commits `interrupt_requested`, then aborts the local
3562
- coordinator signal. `runtime.stop(key)` is the process-local signal-only escape
3563
- hatch.
3573
+ coordinator signal. If provider completion races that revision change, the terminal path reloads
3574
+ the canonical snapshot. An already-terminal winner settles the ticket directly; a still-owned
3575
+ `interrupt_requested` run is committed as `interrupted`, and unrelated aggregate-head conflicts
3576
+ remain retriable while the run is active with the same owner and fencing token. A stale owner or
3577
+ fencing token remains a conflict. Only the execution that applies the terminal mutation emits the
3578
+ terminal event and operator metrics; a loser settles from canonical state without republishing it.
3579
+ `runtime.stop(key)` is the process-local signal-only escape hatch.
3564
3580
 
3565
3581
  ## Store operations
3566
3582
 
@@ -3868,6 +3884,32 @@ validation, dry-run, error envelopes and exit mapping, but deliberately have no
3868
3884
  fake service/action/scope/method identity, lifecycle or tool hooks and never
3869
3885
  appear in MCP/Agent manifests.
3870
3886
 
3887
+ A native command with a declared output may also own its final terminal
3888
+ presentation and successful process status. Both callbacks receive the exact
3889
+ Zod output type and run only after output validation; help, dry-run and failed
3890
+ validation never invoke them:
3891
+
3892
+ ```ts
3893
+ const doctor = defineCliCommand({
3894
+ name: 'doctor',
3895
+ description: 'Inspect local health',
3896
+ input: z.object({}),
3897
+ output: z.object({ status: z.enum(['ok', 'degraded']) }),
3898
+ handler: () => ({ status: 'degraded' }),
3899
+ present: ({ result, options }) =>
3900
+ options.json ? `${JSON.stringify(result)}\n` : `STATUS ${result.status}\n`,
3901
+ exitCode: (result) => result.status === 'degraded' ? 1 : 0,
3902
+ })
3903
+ ```
3904
+
3905
+ `present` returns the exact stdout bytes, which Stitchkit writes once. Without
3906
+ it the canonical JSON output is unchanged. `exitCode` classifies a successfully
3907
+ validated result and must return an integer in `0..255`; failed `ToolResult`
3908
+ envelopes and the application-wide `exitCodes` mapping remain authoritative for
3909
+ failures. A throwing callback, invalid status or non-string presenter becomes a
3910
+ normalized `INTERNAL_SERVER_ERROR`, never partial success output. Void native
3911
+ commands cannot declare either callback.
3912
+
3871
3913
  `--version`, a selected native command and its command help run before
3872
3914
  `resolveAuth`, services, context or runtime-tool factories. Top-level help is
3873
3915
  also credential-free when managed surfaces are static. A dynamic factory must
@@ -3894,9 +3936,52 @@ string, the schema says what it should be:
3894
3936
  | `z.object({...})` | `--opts '{"k":"v"}'` (JSON) or `--opts.k v` |
3895
3937
  | `.optional()` / `.default()` | not required |
3896
3938
 
3897
- Positional arguments fill non-boolean fields in declaration order, so
3898
- `myapp generate "a fox"` is `--prompt "a fox"`. A piped value fills the first
3899
- unset field: `echo "a fox" | myapp generate`.
3939
+ Without presentation configuration, positional arguments fill non-boolean
3940
+ fields in declaration order, so `myapp generate "a fox"` is
3941
+ `--prompt "a fox"`. A piped value fills the first required unset field:
3942
+ `echo "a fox" | myapp generate`.
3943
+
3944
+ For a stable shell grammar, declare the default command, short aliases and the
3945
+ exact positional fields on `createCli`:
3946
+
3947
+ ```ts
3948
+ await createCli({
3949
+ name: 'myapp',
3950
+ version: '1.0.0',
3951
+ services,
3952
+ commands: [doctor],
3953
+ defaultCommand: 'logs',
3954
+ optionAliases: {
3955
+ logs: { f: 'follow', n: 'lines' },
3956
+ },
3957
+ positionals: {
3958
+ logs: ['target'], // `lines` is option-only
3959
+ doctor: [], // no argv positionals
3960
+ },
3961
+ })
3962
+ ```
3963
+
3964
+ Now `myapp`, `myapp --json` and `myapp logs --json` select `logs`;
3965
+ `myapp -f -n 100 --target api` maps to
3966
+ `logs --follow --lines 100 --target api`. A leading non-option token remains an
3967
+ explicit command so typos stay loud rather than becoming ambiguous default
3968
+ positionals; use an explicit `myapp logs api` when passing positionals. Leading
3969
+ framework globals may precede that explicit command. Top-level `--help`, `-h`
3970
+ and `--version` never execute the default, and top-level help marks it.
3971
+
3972
+ Aliases are command-local, one ASCII letter and validated against the resolved
3973
+ command schema. `-f` / `-f=false` are boolean forms; values accept `-n 100` and
3974
+ `-n=100`. Arrays accumulate across short and long forms. `-h` is reserved,
3975
+ bundles such as `-fn`, attached values such as `-n100`, `--no-f` and unknown
3976
+ short flags are rejected. Canonical `--no-follow` remains available.
3977
+
3978
+ `positionals` replaces automatic schema-order selection only for the named
3979
+ command. An empty array disables argv positionals. Fields remain available as
3980
+ long/short options and stdin still fills the first required unset field with the
3981
+ same schema-aware coercion. Unknown, duplicate or boolean targets and a required
3982
+ positional after an optional/default positional fail when that command surface
3983
+ resolves. Native dispatch retains its lazy credential-free boundary; dynamic
3984
+ managed policies validate when their identity-dependent surface resolves.
3900
3985
 
3901
3986
  The advertised schema is never mutated — a CLI call validates against the exact
3902
3987
  same Zod schema an HTTP or MCP call does.
@@ -3921,10 +4006,12 @@ diagnostics remain ordinary stderr text. This keeps stdout pipeable and
3921
4006
  `VALIDATION_ERROR → 1`, `UNAUTHORIZED → 2`, `FORBIDDEN → 3`, `NOT_FOUND → 4`,
3922
4007
  …) — override per app with `exitCodes`.
3923
4008
 
3924
- Per-command help derives the positional form from the same schema order as the
3925
- argv parser. For example, a required `action` and optional `profile` render as
4009
+ Per-command help derives the positional form from the same resolved policy as
4010
+ the argv parser. For example, a required `action` and optional `profile` render as
3926
4011
  `Usage: myapp skill <action> [profile] [--flags]`; the argument table also shows
3927
4012
  `<action> | --action` and `[profile] | --profile`. Boolean fields remain flags.
4013
+ Declared aliases render beside their canonical options, for example
4014
+ `-n, --lines`.
3928
4015
 
3929
4016
  ## `--wait` — background-friendly generation
3930
4017
 
@@ -6576,33 +6663,43 @@ current one *up to* your target, and apply each snippet.
6576
6663
  runtime): bootstrap the server, one HTTP request, and any feature you rely on
6577
6664
  (Socket.IO connect, an MCP tool call, a multipart upload, …).
6578
6665
 
6579
- ## Unreleased migration: complete agent admission identity
6666
+ ## Unreleased migration: normalized agent runtime persistence
6580
6667
 
6581
- Custom `AgentRuntimeStore` adapters must persist and return the input and
6582
- assistant identities associated with an idempotency key:
6668
+ `AgentRuntimeStoreDriver` no longer reads and rewrites a lifetime `AgentStoredState` JSON
6669
+ aggregate. Migrate that row and its recoverable/archive projections once:
6670
+
6671
+ 1. Copy `conversationId` and `version` into the bounded runtime head.
6672
+ 2. Write every `AgentStoredState.runs[]` entry as one normalized run record.
6673
+ 3. Write every `AgentStoredState.admissions[]` entry as one admission receipt and copy its
6674
+ canonical input into that receipt.
6675
+ 4. For terminal runs, retain the canonical assistant on the run record before deleting any old
6676
+ history/archive rows.
6677
+ 5. Replace the recoverable projection with an index over normalized run `state`.
6678
+ 6. Cut the adapter over atomically; there is no compatibility driver or dual-write mode.
6583
6679
 
6584
6680
  ```ts
6585
6681
  // before
6586
- return { outcome: 'duplicate', runId, snapshot }
6682
+ createAgentRuntimeStore({
6683
+ state: { load, compareAndSwap },
6684
+ history: { load, loadById, apply },
6685
+ scanRecoverable,
6686
+ })
6587
6687
 
6588
6688
  // after
6589
- return { outcome: 'duplicate', input, inputMessageId, runId, assistantMessageId, snapshot }
6689
+ createAgentRuntimeStore({
6690
+ head: { load, compareAndSwap },
6691
+ runs: { load, loadByAssistantMessageId, loadMany, listActive, save },
6692
+ admissions: { load, loadByInputMessageId, create },
6693
+ history: { load, apply },
6694
+ scanRecoverable,
6695
+ })
6590
6696
  ```
6591
6697
 
6592
- Prefer replacing the custom aggregate reducer with `createAgentRuntimeStore()`;
6593
- its `AgentStoredState.admissions` record and transaction driver implement this
6594
- contract automatically. `history.loadById()` must retain access to compacted
6595
- admitted inputs so the framework can return the canonical record.
6596
-
6597
- `AgentRuntimeEvent` also adds a post-commit `admission` variant. Add it to any
6598
- exhaustive publisher switch. Its `assistant` is either the pending placeholder
6599
- for a new assignment or the canonical persisted assistant for a duplicate:
6600
-
6601
- ```ts
6602
- case 'admission':
6603
- await persistProductProjection(event.input, event.run, event.assistant)
6604
- break
6605
- ```
6698
+ `AgentRuntimeHeadSchema`, `AgentStoredRunSchema` and `AgentAdmissionReceiptSchema` replace
6699
+ `AgentStoredStateSchema` and `AgentAdmissionIdentitySchema`. Run
6700
+ `runAgentStoreConformance()` against the migrated adapter before switching production traffic.
6701
+ If an application implements `AgentRuntimeStore` directly, its duplicate result must also include
6702
+ the canonical `run` and the retained `assistant` for a terminal run.
6606
6703
 
6607
6704
  ## Released migration: 0.56.0
6608
6705
 
@@ -8039,13 +8136,15 @@ Server-only optional application runtime. See the
8039
8136
 
8040
8137
  | Export | Kind | Summary |
8041
8138
  |--------|------|---------|
8042
- | `createAgentRuntime` | function | compose durable acceptance, stream loop, checkpoints, coordination, managed tools and terminal publication |
8139
+ | `createAgentRuntime` | function | compose durable acceptance, stream loop, checkpoints, coordination, managed tools and winner-only terminal publication; reconciles same-owner terminal/interrupt/head CAS races before releasing the lane |
8043
8140
  | `defineAgentProtocol` | function | declare and validate context, input metadata and canonical message parts |
8044
8141
  | `AgentMessageSchema` / `AgentRunSchema` / `AgentSnapshotSchema` | schema | versioned canonical engine records |
8045
8142
  | `AgentRuntimeStore` | _type_ | aggregate CAS transaction boundary for message, run and compaction mutations |
8046
8143
  | `createAgentRuntimeStore` | function | build the aggregate store from one coherent transaction driver; framework owns every state transition |
8047
- | `AgentRuntimeStoreDriver` | _type_ | ORM-neutral transactional state load/exact-version CAS, active-plus-archived history codec and bounded recoverable-run index scan |
8048
- | `AgentStoredStateSchema` | schema | versioned runs and full idempotency admission identities without duplicated message history |
8144
+ | `AgentRuntimeStoreDriver` | _type_ | ORM-neutral transaction over a bounded head, normalized runs/admissions, product history and indexed run recovery |
8145
+ | `AgentRuntimeHeadSchema` | schema | constant-size conversation identity plus monotonic runtime version |
8146
+ | `AgentStoredRunSchema` | schema | canonical normalized run with an optional retained terminal assistant |
8147
+ | `AgentAdmissionReceiptSchema` | schema | durable idempotency receipt with canonical input and assigned run/assistant identities |
8049
8148
  | `AgentHistoryMutationSchema` | schema | typed canonical message mutation applied inside the winning state transaction |
8050
8149
  | `RecoverAgentRunSchema` | schema | explicit abandon/requeue recovery decision; acquired runs require replay-safe evidence |
8051
8150
  | `createMemoryAgentRuntimeStore` | function | process-local reference adapter, not production durability |
@@ -8095,8 +8194,8 @@ Store command/result exports are `AcceptInputAndAssignRun`, `AcceptInputAndAssig
8095
8194
  `RequestRunInterrupt`, `RequestRunInterruptSchema`, `RecoverAgentRun`, `ReplaceCompactedRange`,
8096
8195
  `ReplaceCompactedRangeSchema`, `AgentStoreMutationResult`, `AgentStoreMutationResultSchema`,
8097
8196
  `AgentStoreAppliedSchema`, `AgentStoreConflictSchema`, `AgentStoreDuplicateSchema`,
8098
- `AgentStoreNotFoundSchema`, `AgentAdmissionIdentity`, `AgentAdmissionIdentitySchema`,
8099
- `AgentStoredState`, `AgentStoreCompareAndSwapResult`, `AgentHistoryMutation`,
8197
+ `AgentStoreNotFoundSchema`, `AgentAdmissionReceipt`, `AgentAdmissionReceiptSchema`,
8198
+ `AgentRuntimeHead`, `AgentStoredRun`, `AgentStoreCompareAndSwapResult`, `AgentHistoryMutation`,
8100
8199
  `AgentRecoverableDescriptor`, `AgentRecoverableDescriptorSchema`, `AgentRecoverablePage` and
8101
8200
  `AgentRecoverablePageSchema`.
8102
8201
 
@@ -8242,7 +8341,7 @@ payload.
8242
8341
  | `createRuntimeToolFactory` | function | bind shared identity and Zod-validated per-call context for runtime tools — [guide](../guide/mcp-and-agents.md#pathless-runtime-tools-and-multimodal-results) |
8243
8342
  | `createToolInvoker` | function | compile an exposure-aware in-process dispatcher over the canonical tool runner — [guide](../guide/mcp-and-agents.md#in-process-calls--createtoolinvoker) |
8244
8343
  | `createCli` | function | a command-line program from contracts — [guide](../guide/cli.md) (also on `stitchkit/cli`) |
8245
- | `defineCliCommand` | function | define one typed CLI-only command with no fake managed-tool identity — [guide](../guide/cli.md#native-binary-commands) (also on `stitchkit/cli`) |
8344
+ | `defineCliCommand` | function | define one typed CLI-only command with optional post-validation `present` and successful `exitCode` policy — [guide](../guide/cli.md#native-binary-commands) (also on `stitchkit/cli`) |
8246
8345
  | `createToolkit` | function | context-typed tool mounts — [guide](../guide/cli.md#typed-context) |
8247
8346
  | `mountViewFile` | function | a native multimodal "view file" MCP tool |
8248
8347
  | `resolveMedia` | function | resolve a media reference for a tool result |
@@ -8299,11 +8398,12 @@ payload.
8299
8398
  | `RuntimeToolTransport` | _type_ | runtime exposure: `'MCP' \| 'AGENT' \| 'CLI'`; omission still means MCP+Agent only |
8300
8399
  | `AgentMountConfig` | _type_ | config for `mountAgent` |
8301
8400
  | `AgentContext` | _type_ | the context merged into agent tool handlers |
8302
- | `CliConfig` | _type_ | config for `createCli` |
8401
+ | `CliConfig` | _type_ | config for `createCli`, including program-level `defaultCommand` selection and command-scoped `optionAliases` / `positionals` policy |
8402
+ | `CliPresentationPolicyConfig` | _type_ | reusable default-command, short-alias and explicit-positional policy inherited by `CliConfig` |
8303
8403
  | `CliSurfaceSource` | _type_ | static managed surface or identity-dependent surface factory for `createCli` |
8304
8404
  | `CliCommandDefinition` | _type_ | Zod-first CLI-only command union |
8305
8405
  | `CliCommandDefinitionBase` | _type_ | native command name, description and input schema |
8306
- | `CliCommandDefinitionWithOutput` | _type_ | native command with declared output schema and validated handler result |
8406
+ | `CliCommandDefinitionWithOutput` | _type_ | native command with declared output schema, validated handler result and typed optional `present` / `exitCode` callbacks |
8307
8407
  | `CliCommandDefinitionWithoutOutput` | _type_ | void native command with no output schema |
8308
8408
  | `CliCommandContext` | _type_ | parsed native command input, global options and injected writers |
8309
8409
  | `CliWaitConfig` | _type_ | `--wait` polling config |
@@ -8567,16 +8667,17 @@ SDK nor the `ai` peer.
8567
8667
  | Export | Kind | Summary |
8568
8668
  |--------|------|---------|
8569
8669
  | `createCli` | function | build and run a CLI from contracts — [guide](../guide/cli.md) |
8570
- | `defineCliCommand` | function | define one Zod-typed CLI-only executable command |
8670
+ | `defineCliCommand` | function | define one Zod-typed CLI-only executable command with optional validated-result presentation/exit policy |
8571
8671
  | `parseCliArgs` | function | argv → typed tool args against a schema (advanced) |
8572
8672
  | `pollUntilDone` | function | the generic `--wait` poller (advanced) |
8573
8673
  | `emitResult` | function | write a pretty or compact `ToolResult` record to stdout/stderr + exit code (advanced) |
8574
8674
  | `DEFAULT_EXIT_CODES` | const | the default `ToolResult.code` → exit-code map |
8575
- | `CliConfig` | _type_ | config for `createCli` |
8675
+ | `CliConfig` | _type_ | config for `createCli`; `defaultCommand`, `optionAliases` and `positionals` define the shared command presentation policy |
8676
+ | `CliPresentationPolicyConfig` | _type_ | shared command presentation-policy subset of `CliConfig` |
8576
8677
  | `CliSurfaceSource` | _type_ | static service/runtime array or identity-dependent factory |
8577
8678
  | `CliCommandDefinition` | _type_ | native command definition union |
8578
8679
  | `CliCommandDefinitionBase` | _type_ | native command name, description and input schema |
8579
- | `CliCommandDefinitionWithOutput` | _type_ | native command with validated declared output |
8680
+ | `CliCommandDefinitionWithOutput` | _type_ | native command with validated declared output and typed optional `present` / successful `exitCode` callbacks |
8580
8681
  | `CliCommandDefinitionWithoutOutput` | _type_ | native void command without an output contract |
8581
8682
  | `CliCommandContext` | _type_ | parsed input, global options and stdout/stderr writers |
8582
8683
  | `CliRunOptions` | _type_ | parsed global flags (`--json` compacts success/error records, `--wait`, …) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.58.0",
3
+ "version": "0.59.1",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",