sh3-core 0.14.3 → 0.15.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.
@@ -86,6 +86,49 @@ export interface VerbContext {
86
86
  fs: TenantFsClient;
87
87
  /** Invoke another registered verb programmatically (used by rich-entry clicks). */
88
88
  dispatch(line: string): Promise<void>;
89
+ /**
90
+ * When the verb was invoked via `ctx.runVerb(..., { structured })`,
91
+ * this holds the structured payload the caller passed. Terminal-driven
92
+ * invocations leave it undefined and the verb falls back to `args[]`.
93
+ * See `Verb.schema.input` for the JSON Schema describing the shape.
94
+ */
95
+ structuredArgs?: unknown;
96
+ /**
97
+ * When the verb was invoked via `ctx.runVerb(..., { signal })`, this
98
+ * carries the abort signal so cooperative verbs can honor cancellation.
99
+ * Terminal-driven invocations leave it undefined.
100
+ */
101
+ signal?: AbortSignal;
102
+ }
103
+ /**
104
+ * Portable JSON Schema subset accepted by sh3-core for `Verb.schema.input`.
105
+ * Documented as the intersection of what Anthropic, OpenAI, and Gemini
106
+ * tool-call APIs accept natively. sh3-core does NOT validate that the
107
+ * actual schema stays within this subset — authors who reach for `oneOf`,
108
+ * `$ref`, or other Draft 2020-12 features do so at their own portability
109
+ * risk. The type is intentionally `unknown`-permissive on `properties`
110
+ * and `items` so authors can express object/array shapes without
111
+ * fighting the type system.
112
+ */
113
+ export interface PortableJSONSchema {
114
+ type?: 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
115
+ description?: string;
116
+ enum?: unknown[];
117
+ default?: unknown;
118
+ /** Object-shape property map (key → sub-schema). */
119
+ properties?: Record<string, PortableJSONSchema>;
120
+ /** Required property names for `type: 'object'`. */
121
+ required?: string[];
122
+ /** Item schema for `type: 'array'`. */
123
+ items?: PortableJSONSchema;
124
+ }
125
+ /**
126
+ * Optional schema attached to a verb. Today only `input` is consumed
127
+ * (by sh3-ai's tool-call dispatcher); `output` is deferred until
128
+ * sh3-editor's graph view materializes a real consumer.
129
+ */
130
+ export interface VerbSchema {
131
+ input: PortableJSONSchema;
89
132
  }
90
133
  export interface Verb {
91
134
  name: string;
@@ -98,6 +141,23 @@ export interface Verb {
98
141
  * `mode` switches modes — both make sense everywhere).
99
142
  */
100
143
  globalVerb?: boolean;
144
+ /**
145
+ * When true, this verb opts in to dispatch via `ctx.runVerb(...)`. By
146
+ * setting this flag the author commits to behaving correctly outside a
147
+ * real terminal frame — in particular, treating `ctx.scrollback` as a
148
+ * sink whose entries the caller may render later, and not depending on
149
+ * UI side-effects beyond what the synthesized context provides
150
+ * (no `ctx.session.connect()`, no terminal-mode switching, etc.).
151
+ * Defaults to false; `runVerb` rejects non-programmatic verbs.
152
+ */
153
+ programmatic?: boolean;
154
+ /**
155
+ * Optional input/output schema for typed callers. When present and the
156
+ * caller dispatches with `runVerb(..., { structured })`, the structured
157
+ * payload is delivered via `ctx.structuredArgs`; the verb chooses
158
+ * whether to read it or fall back to `args[]`.
159
+ */
160
+ schema?: VerbSchema;
101
161
  run(ctx: VerbContext, args: string[]): Promise<void>;
102
162
  }
103
163
  export type Resolution = {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Auto-generated from package.json — do not edit manually. */
2
- export declare const VERSION = "0.14.3";
2
+ export declare const VERSION = "0.15.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Auto-generated from package.json — do not edit manually. */
2
- export const VERSION = '0.14.3';
2
+ export const VERSION = '0.15.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sh3-core",
3
- "version": "0.14.3",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"