@bendyline/gezel-sdk 0.1.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.
@@ -0,0 +1,589 @@
1
+ import { S as ScriptMeta, I as InferInput, a as InferOutput, b as ScriptInputs, c as ScriptOutputs } from './types-cYfcp6_8.js';
2
+ export { G as GateScriptResult, d as ScriptArrayOutput, e as ScriptBooleanInput, f as ScriptBooleanOutput, g as ScriptCapability, h as ScriptChoiceInput, i as ScriptChoiceOption, j as ScriptInputField, k as ScriptJsonInput, l as ScriptJsonOutput, m as ScriptNumberInput, n as ScriptNumberOutput, o as ScriptObjectOutput, p as ScriptOutputField, q as ScriptRefInput, r as ScriptStringInput, s as ScriptStringOutput } from './types-cYfcp6_8.js';
3
+
4
+ /**
5
+ * `@bendyline/gezel-sdk` — imported by TypeScript scripts running in the
6
+ * Gezel sandbox. Exposes the `gezel` object (typed proxy over the fd-3
7
+ * RPC channel) and `defineScript` (type helper for meta declarations).
8
+ *
9
+ * This module's top-level side effect is to read the init payload from
10
+ * stdin synchronously, so `gezel.input` is available to the first line
11
+ * of user code.
12
+ */
13
+
14
+ /**
15
+ * Type-only helper that preserves the descriptor and lets downstream
16
+ * type inference (on `gezel.input` / the chained `gezel.output` payload)
17
+ * read it. Pass `as const` to get literal inference on choice options.
18
+ */
19
+ declare function defineScript<I extends ScriptInputs | undefined, O extends ScriptOutputs | undefined>(meta: ScriptMeta<I, O>): ScriptMeta<I, O>;
20
+ /** A single entry returned by {@link GezelSDK.fs | `gezel.fs.list`}. */
21
+ interface FsEntry {
22
+ /** Base name of the entry (not the full path), e.g. `index.html`. */
23
+ name: string;
24
+ /** `true` for directories, `false` for regular files. */
25
+ isDirectory: boolean;
26
+ /** Size in bytes. `0` for directories. */
27
+ size: number;
28
+ /** Last-modified time as an ISO-8601 timestamp. */
29
+ modified: string;
30
+ }
31
+ /** Metadata returned by {@link GezelSDK.fs | `gezel.fs.stat`}. */
32
+ interface FsStat {
33
+ /** Size in bytes. */
34
+ size: number;
35
+ /** Last-modified time as an ISO-8601 timestamp. */
36
+ modified: string;
37
+ /** `true` if the path is a directory. */
38
+ isDirectory: boolean;
39
+ /** `true` if the path is a regular file. */
40
+ isFile: boolean;
41
+ }
42
+ /** A single entry returned by {@link GezelSDK.artifacts | `gezel.artifacts.list`}. */
43
+ interface ArtifactEntry {
44
+ /** Artifact path relative to the project's artifact store. */
45
+ path: string;
46
+ /** Size in bytes. */
47
+ size: number;
48
+ /** Last-modified time as an ISO-8601 timestamp. */
49
+ modified: string;
50
+ }
51
+ /** A single entry returned by {@link GezelSDK.documents | `gezel.documents.list`}. */
52
+ interface DocumentEntry {
53
+ /** Document name (its key in the shared document store). */
54
+ name: string;
55
+ /** Size in bytes. */
56
+ size: number;
57
+ /** Last-modified time as an ISO-8601 timestamp. */
58
+ modified: string;
59
+ }
60
+ /** Options for {@link GezelSDK.llm | `gezel.llm.oneShot`}. */
61
+ interface OneShotOpts {
62
+ /**
63
+ * Hard timeout for the completion, in milliseconds. The call rejects
64
+ * if the model has not finished within this window. Defaults to
65
+ * `120000` (2 minutes).
66
+ */
67
+ timeoutMs?: number;
68
+ /**
69
+ * Override the model used for this single call (e.g. `'gemma-12b'`).
70
+ * When omitted, the project's configured default model is used.
71
+ */
72
+ model?: string;
73
+ }
74
+ /** Options for an unauthenticated {@link GezelSDK.http} request. */
75
+ interface HttpRequestOpts {
76
+ /** HTTP method. Defaults to `'GET'`. */
77
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
78
+ /** Raw request body, already serialized. */
79
+ body?: string;
80
+ /** Extra headers. Anonymous requests reject `Authorization`. */
81
+ headers?: Record<string, string>;
82
+ }
83
+ /** Options for {@link GezelSDK.http | `gezel.http.authed`}. */
84
+ interface AuthedHttpOpts {
85
+ /**
86
+ * Short credential name. The script must declare `credential:<name>`
87
+ * in `meta.requires`, and the project must have granted access to it.
88
+ * The service resolves this to a raw secret at dispatch time and
89
+ * attaches the auth header — the script never sees the secret value.
90
+ */
91
+ credential: string;
92
+ /** HTTP method. Defaults to `'GET'`. */
93
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
94
+ /** Raw request body (already serialized — e.g. a JSON string). */
95
+ body?: string;
96
+ /**
97
+ * Extra request headers. The `Authorization` header is added by the
98
+ * service from the resolved credential and will override any value
99
+ * you set here.
100
+ */
101
+ headers?: Record<string, string>;
102
+ /**
103
+ * How the credential is attached to the `Authorization` header:
104
+ * `'bearer'` → `Bearer <value>`, `'basic'` → `Basic <value>`.
105
+ * Defaults to `'bearer'`.
106
+ */
107
+ authScheme?: 'bearer' | 'basic';
108
+ }
109
+ /** The response returned by {@link GezelSDK.http | `gezel.http.authed`}. */
110
+ interface AuthedHttpResponse {
111
+ /** HTTP status code (e.g. `200`, `404`). */
112
+ status: number;
113
+ /** `true` when `status` is in the 2xx range. */
114
+ ok: boolean;
115
+ /** Response headers, lower-cased keys. */
116
+ headers: Record<string, string>;
117
+ /**
118
+ * Response body as text. Any occurrence of the resolved credential
119
+ * value is scrubbed before the body reaches the script. Parse with
120
+ * `JSON.parse(res.body)` when you expect JSON.
121
+ */
122
+ body: string;
123
+ }
124
+ /** Response returned by unauthenticated and credentialed HTTP requests. */
125
+ type HttpResponse = AuthedHttpResponse;
126
+ /**
127
+ * A single step of a task's craftbook, as returned by
128
+ * {@link GezelSDK.task | `gezel.task.steps`} and `gezel.task.currentStep`.
129
+ * This is a curated, read-only view — the internal routing machinery
130
+ * (gates, branches, hook script refs) is intentionally omitted.
131
+ */
132
+ interface TaskStep {
133
+ /** Stable step id — the value used as `phaseId` / routing `goto` elsewhere. */
134
+ id: string;
135
+ /** Human-readable step name. */
136
+ name: string;
137
+ /** Optional longer description of what the step is for. */
138
+ description?: string;
139
+ /**
140
+ * Lifecycle status derived from the task's state: the currently-active
141
+ * step is `'active'`, a step that has been completed is `'complete'`,
142
+ * and any step not yet reached is `'pending'`. (On a loop-back the
143
+ * re-activated step reports `'active'` again.)
144
+ */
145
+ status: 'pending' | 'active' | 'complete';
146
+ /** `true` if this is the task's currently-active step. */
147
+ isActive: boolean;
148
+ /** ISO-8601 timestamp of when the step completed, if it has. */
149
+ completedAt?: string;
150
+ /**
151
+ * How many times this step has been activated. A linear run touches a
152
+ * step once; a looping craftbook re-activates it each pass, so the
153
+ * count climbs. Absent until the step first activates.
154
+ */
155
+ attemptCount?: number;
156
+ /** `true` if this is a terminal step (no further routing after it). */
157
+ terminal?: boolean;
158
+ }
159
+ /** Who authored a {@link TaskNote}. */
160
+ type TaskNoteAuthor = {
161
+ kind: 'user';
162
+ } | {
163
+ kind: 'gezel';
164
+ gezelId: string;
165
+ name: string;
166
+ };
167
+ /** A single note on a task, as returned by `gezel.task.appendNote`. */
168
+ interface TaskNote {
169
+ /** Stable note id (pass to `gezel.task.deleteNote`). */
170
+ id: string;
171
+ /** ISO-8601 timestamp of when the note was written. */
172
+ at: string;
173
+ /** Who wrote the note. Notes written by scripts are authored as the user. */
174
+ author: TaskNoteAuthor;
175
+ /** The step this note is attached to, if any. */
176
+ stepId?: string;
177
+ /** The note text. */
178
+ text: string;
179
+ }
180
+ /** The result of a nested {@link GezelSDK.script | `gezel.script.run`} call. */
181
+ interface ScriptResult<TOutput = unknown> {
182
+ /** Unique id of the nested run, useful for correlating trace logs. */
183
+ runId: string;
184
+ /** `'ok'` if the nested script completed; `'error'` if it threw. */
185
+ status: 'ok' | 'error';
186
+ /**
187
+ * The value the nested script stamped via `gezel.output(...)`.
188
+ * Present only when `status === 'ok'`. Pass a type argument to
189
+ * `script.run<T>()` to type this field.
190
+ */
191
+ output?: TOutput;
192
+ /** Error message when `status === 'error'`; otherwise absent. */
193
+ error?: string;
194
+ }
195
+ /**
196
+ * The `gezel` object — the single entry point a script uses to reach the
197
+ * sandbox host. Every method is a typed proxy over the fd-3 RPC channel;
198
+ * each namespace (`fs`, `artifact`, `task`, …) maps to a capability that
199
+ * must be declared in the script's `meta.requires` (see
200
+ * {@link ScriptCapability}). Calling a method whose capability was not
201
+ * declared rejects with a `CAPABILITY_DENIED` error.
202
+ *
203
+ * @typeParam TInput - Shape of {@link GezelSDK.input | `gezel.input`}.
204
+ * Narrow it with {@link InferredInput} from your `defineScript` meta.
205
+ *
206
+ * @example Read a file, ask the model about it, and stamp the result:
207
+ * ```ts
208
+ * import { gezel, defineScript, type InferredInput } from '@bendyline/gezel-sdk';
209
+ *
210
+ * export const meta = defineScript({
211
+ * name: 'summarize-readme',
212
+ * description: 'Summarize the project README.',
213
+ * inputs: { path: { type: 'string', description: 'File to read', default: 'README.md' } },
214
+ * outputs: { summary: { type: 'string', description: 'One-paragraph summary' } },
215
+ * requires: ['workspace.read', 'llm'],
216
+ * } as const);
217
+ *
218
+ * const input = gezel.input as InferredInput<typeof meta>;
219
+ * const text = await gezel.fs.read(input.path ?? 'README.md');
220
+ * const summary = await gezel.llm.oneShot(`Summarize:\n\n${text}`);
221
+ * gezel.output({ summary });
222
+ * ```
223
+ */
224
+ interface GezelSDK<TInput = Record<string, unknown>> {
225
+ /**
226
+ * Parsed and validated input for this run, populated from the init
227
+ * payload before the first line of user code executes. Cast it to a
228
+ * precise type with {@link InferredInput} for full autocomplete:
229
+ *
230
+ * ```ts
231
+ * const input = gezel.input as InferredInput<typeof meta>;
232
+ * ```
233
+ */
234
+ readonly input: TInput;
235
+ /**
236
+ * Stamp the script's final output. **Call exactly once per run** —
237
+ * a second call throws. For a `gate` script, pass a
238
+ * {@link GateScriptResult}; for an `action` script, pass the object
239
+ * described by `meta.outputs`.
240
+ *
241
+ * @param value - The result payload to record for this run.
242
+ */
243
+ output(value: unknown): void;
244
+ /**
245
+ * Emit a structured log line, captured as part of the ScriptRun
246
+ * trace and also mirrored to stderr. Use it for progress and
247
+ * debugging; it does not affect the script's output.
248
+ *
249
+ * @param args - Values to log. Non-strings are JSON-stringified.
250
+ */
251
+ log(...args: unknown[]): void;
252
+ /**
253
+ * Project **workspace** files (the editable source tree). Paths are
254
+ * relative to the workspace root and sandboxed — they cannot escape
255
+ * it. Requires `workspace.read` for reads and `workspace.write` for
256
+ * writes.
257
+ *
258
+ * @example
259
+ * ```ts
260
+ * const files = await gezel.fs.listAll();
261
+ * const html = await gezel.fs.read('index.html');
262
+ * await gezel.fs.write('out/notes.md', '# Notes\n');
263
+ * ```
264
+ */
265
+ fs: {
266
+ /**
267
+ * Read a workspace file as UTF-8 text.
268
+ * @param path - Workspace-relative path.
269
+ * @returns The file contents.
270
+ * @throws If the file does not exist (`file not found: <path>`).
271
+ */
272
+ read(path: string): Promise<string>;
273
+ /**
274
+ * Write a workspace file, creating parent directories as needed
275
+ * and overwriting any existing file.
276
+ * @param path - Workspace-relative path.
277
+ * @param content - UTF-8 text to write.
278
+ */
279
+ write(path: string, content: string): Promise<void>;
280
+ /**
281
+ * List the immediate children of a directory (non-recursive).
282
+ * @param path - Workspace-relative directory; defaults to the root.
283
+ * @returns Entries for files and subdirectories.
284
+ */
285
+ list(path: string): Promise<FsEntry[]>;
286
+ /**
287
+ * Relative paths of ALL workspace files (recursive, one
288
+ * round-trip). Directories are omitted. Prefer this over walking
289
+ * {@link list} yourself.
290
+ */
291
+ listAll(): Promise<string[]>;
292
+ /**
293
+ * Stat a workspace path.
294
+ * @param path - Workspace-relative path.
295
+ * @returns Size, mtime, and file/directory flags.
296
+ */
297
+ stat(path: string): Promise<FsStat>;
298
+ /**
299
+ * Remove a workspace file.
300
+ * @param path - Workspace-relative path.
301
+ */
302
+ rm(path: string): Promise<void>;
303
+ /**
304
+ * Create a directory in the workspace.
305
+ * @param path - Workspace-relative path.
306
+ * @remarks {@link write} already creates parent directories, so this
307
+ * is only needed to materialize an empty directory.
308
+ */
309
+ mkdir(path: string): Promise<void>;
310
+ /**
311
+ * Rename / move a workspace file.
312
+ * @param from - Existing workspace-relative path.
313
+ * @param to - Destination workspace-relative path.
314
+ */
315
+ rename(from: string, to: string): Promise<void>;
316
+ };
317
+ /**
318
+ * Project **artifacts** — generated output files kept separately from
319
+ * the editable workspace (build products, reports, exports). Requires
320
+ * `artifacts.read` / `artifacts.write`.
321
+ */
322
+ artifacts: {
323
+ /**
324
+ * Read an artifact as UTF-8 text.
325
+ * @throws If the artifact does not exist (`artifact not found: <path>`).
326
+ */
327
+ read(path: string): Promise<string>;
328
+ /** Write (or overwrite) an artifact. */
329
+ write(path: string, content: string): Promise<void>;
330
+ /**
331
+ * List artifacts, optionally filtered by path prefix.
332
+ * @param prefix - Only return artifacts whose path starts with this.
333
+ */
334
+ list(prefix?: string): Promise<ArtifactEntry[]>;
335
+ /** Delete an artifact. */
336
+ delete(path: string): Promise<void>;
337
+ };
338
+ /**
339
+ * Shared **documents** — a project-independent key/value store of
340
+ * named text documents. Requires `documents.read` / `documents.write`.
341
+ */
342
+ documents: {
343
+ /**
344
+ * Read a document by name.
345
+ * @throws If the document does not exist (`document not found: <name>`).
346
+ */
347
+ read(name: string): Promise<string>;
348
+ /** Write (or overwrite) a document by name. */
349
+ write(name: string, content: string): Promise<void>;
350
+ /** List all documents. */
351
+ list(): Promise<DocumentEntry[]>;
352
+ /** Delete a document by name. */
353
+ delete(name: string): Promise<void>;
354
+ };
355
+ /**
356
+ * **Tasks** — read, mutate, and annotate the project's task records.
357
+ * The `ref` is either `"<num>"` (a task number in the current project)
358
+ * or `"<projectId>/<num>"` to reach another project. Requires
359
+ * `tasks.read` for reads and `tasks.write` for mutations.
360
+ */
361
+ task: {
362
+ /**
363
+ * Fetch a task record.
364
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
365
+ * @returns The full task object.
366
+ * @throws If the task does not exist (`task not found: <ref>`).
367
+ */
368
+ get(ref: string): Promise<unknown>;
369
+ /**
370
+ * List all steps of the task's craftbook, in order, each with its
371
+ * derived {@link TaskStep.status | status}.
372
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
373
+ * @returns The task's steps as curated {@link TaskStep} views.
374
+ *
375
+ * @example
376
+ * ```ts
377
+ * const steps = await gezel.task.steps('7');
378
+ * const done = steps.filter((s) => s.status === 'complete').length;
379
+ * gezel.log(`progress: ${done}/${steps.length}`);
380
+ * ```
381
+ */
382
+ steps(ref: string): Promise<TaskStep[]>;
383
+ /**
384
+ * Get the task's currently-active step.
385
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
386
+ * @returns The active {@link TaskStep}, or `null` if no step is active.
387
+ */
388
+ currentStep(ref: string): Promise<TaskStep | null>;
389
+ /**
390
+ * Patch fields on a task (e.g. `title`, `description`, `plan`,
391
+ * `assignee`).
392
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
393
+ * @param patch - Partial set of task fields to update.
394
+ * @returns The updated task object.
395
+ */
396
+ update(ref: string, patch: Record<string, unknown>): Promise<unknown>;
397
+ /**
398
+ * Complete the task's currently-active step, advancing the craftbook.
399
+ * Completion gates run as usual; if a gate holds the step the call
400
+ * resolves with a `held` outcome rather than throwing.
401
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
402
+ * @param nextPhaseName - Optional step to route to, overriding the
403
+ * craftbook's default next step.
404
+ * @returns The completion outcome (`{ status, task, gate? }`).
405
+ * @throws If the task has no active step to advance.
406
+ */
407
+ advance(ref: string, nextPhaseName?: string): Promise<unknown>;
408
+ /**
409
+ * Append a note to a task (fire-and-forget). Use {@link appendNote}
410
+ * instead when you need the created note back.
411
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
412
+ * @param content - The note text.
413
+ * @param phaseId - Optional step id to attach the note to.
414
+ */
415
+ writeNotes(ref: string, content: string, phaseId?: string): Promise<void>;
416
+ /**
417
+ * Append a note to a task and return it — the convenient CRUD form of
418
+ * {@link writeNotes}, handy when you want the generated `id`/`at`.
419
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
420
+ * @param text - The note text.
421
+ * @param stepId - Optional step id to attach the note to.
422
+ * @returns The created note.
423
+ */
424
+ appendNote(ref: string, text: string, stepId?: string): Promise<TaskNote>;
425
+ /**
426
+ * Read a task's notes as a single string (note bodies joined by
427
+ * blank lines).
428
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
429
+ * @param phaseId - Optional step id to filter notes by.
430
+ * @returns The concatenated note text (empty string if none).
431
+ */
432
+ readNotes(ref: string, phaseId?: string): Promise<string>;
433
+ /**
434
+ * Delete a note from a task by id.
435
+ * @param ref - `"<num>"` or `"<projectId>/<num>"`.
436
+ * @param noteId - The id of the note to remove.
437
+ * @returns The removed note, or `null` if no note with that id existed.
438
+ */
439
+ deleteNote(ref: string, noteId: string): Promise<TaskNote | null>;
440
+ /**
441
+ * Create a new task in the current project.
442
+ * @param req - The create-task request (title, description, craftbook
443
+ * selection, assignee, …).
444
+ * @returns The newly created task object.
445
+ */
446
+ create(req: Record<string, unknown>): Promise<unknown>;
447
+ };
448
+ /**
449
+ * **Memory** — semantic store of prior learnings. Requires
450
+ * `memory.read` / `memory.write`.
451
+ *
452
+ * @example
453
+ * ```ts
454
+ * const hits = await gezel.memory.search('how we handle auth') as
455
+ * { text: string; score: number }[];
456
+ * await gezel.memory.save('Auth uses bearer tokens from the registry.');
457
+ * ```
458
+ */
459
+ memory: {
460
+ /**
461
+ * Semantic search over the project's saved memories.
462
+ * @param query - Natural-language query.
463
+ * @returns Ranked hits, each `{ text, score, day, scope, id, kind }`
464
+ * (highest score first).
465
+ */
466
+ search(query: string): Promise<unknown[]>;
467
+ /**
468
+ * Save a memory to the project's store. Near-duplicate text is
469
+ * skipped automatically.
470
+ * @param text - The fact to remember.
471
+ * @param meta - Optional metadata. A `kind` of `'fact'` |
472
+ * `'decision'` | `'pref'` | `'status'` categorizes the memory;
473
+ * other fields are ignored.
474
+ */
475
+ save(text: string, meta?: Record<string, unknown>): Promise<void>;
476
+ };
477
+ /**
478
+ * **LLM** — one-shot model completions. Requires the `llm` capability,
479
+ * and the project's AI engagement mode must not be `off` (otherwise
480
+ * the call rejects with an engagement error).
481
+ */
482
+ llm: {
483
+ /**
484
+ * Run a single prompt to completion and return the text.
485
+ * @param prompt - The full prompt to send.
486
+ * @param opts - Optional timeout / model override; see {@link OneShotOpts}.
487
+ * @returns The model's text response.
488
+ *
489
+ * @example
490
+ * ```ts
491
+ * const answer = await gezel.llm.oneShot('Name three primary colors.');
492
+ * ```
493
+ */
494
+ oneShot(prompt: string, opts?: OneShotOpts): Promise<string>;
495
+ };
496
+ /**
497
+ * **MCP** — escape hatch to invoke any tool on the shared MCP surface
498
+ * (e.g. GitHub, web fetch). Requires the `network` capability.
499
+ */
500
+ mcp: {
501
+ /**
502
+ * Invoke an MCP tool by name.
503
+ * @param tool - Tool name, e.g. `'github_pr_create'`.
504
+ * @param args - Tool arguments (tool-specific shape).
505
+ * @returns The tool's raw result.
506
+ *
507
+ * @example
508
+ * ```ts
509
+ * const res = await gezel.mcp.call('github_pr_create', {
510
+ * title: 'My change', body: '...', base: 'main',
511
+ * });
512
+ * ```
513
+ */
514
+ call(tool: string, args: unknown): Promise<unknown>;
515
+ };
516
+ /**
517
+ * Credentialed HTTP. The script names the credential it wants to
518
+ * use — the service resolves the value, attaches auth, and returns
519
+ * only the response body + headers. The raw credential value
520
+ * NEVER enters the script's address space.
521
+ *
522
+ * Scripts must declare `credential:<name>` in `meta.requires` for
523
+ * every credential they intend to use (in addition to `network`); the
524
+ * target project must have explicitly granted access to the
525
+ * credential. Missing grants, missing stored values, and missing
526
+ * capability declarations each produce distinct typed errors.
527
+ *
528
+ * @example
529
+ * ```ts
530
+ * const res = await gezel.http.authed('https://api.example.com/me', {
531
+ * credential: 'example-token',
532
+ * });
533
+ * if (res.ok) {
534
+ * const me = JSON.parse(res.body);
535
+ * }
536
+ * ```
537
+ */
538
+ http: {
539
+ /**
540
+ * Perform an unauthenticated HTTP request through the sandbox host.
541
+ * Redirects are returned without being followed.
542
+ */
543
+ request(url: string, opts?: HttpRequestOpts): Promise<HttpResponse>;
544
+ /**
545
+ * Perform an authenticated HTTP request.
546
+ * @param url - Absolute URL to request.
547
+ * @param opts - Method, body, headers, and the credential to use;
548
+ * see {@link AuthedHttpOpts}.
549
+ * @returns Status, headers, and the (secret-scrubbed) body.
550
+ */
551
+ authed(url: string, opts: AuthedHttpOpts): Promise<AuthedHttpResponse>;
552
+ };
553
+ /**
554
+ * **Nested scripts** — run another script in the same project and get
555
+ * its stamped output back. No capability is required to call, but the
556
+ * nested script runs under its own `meta.requires`. Nesting is limited
557
+ * to 4 levels deep.
558
+ */
559
+ script: {
560
+ /**
561
+ * Run another script by name and await its result.
562
+ * @typeParam TOutput - Expected shape of the nested script's output.
563
+ * @param name - The script's name (not a path), e.g. `'diff-scan'`.
564
+ * @param input - Input object passed to the nested script.
565
+ * @returns A {@link ScriptResult} carrying status, output, or error.
566
+ *
567
+ * @example
568
+ * ```ts
569
+ * const res = await gezel.script.run<{ issues: string[] }>('diff-scan');
570
+ * if (res.status === 'ok') {
571
+ * for (const issue of res.output!.issues) gezel.log(issue);
572
+ * }
573
+ * ```
574
+ */
575
+ run<TOutput = unknown>(name: string, input?: Record<string, unknown>): Promise<ScriptResult<TOutput>>;
576
+ };
577
+ }
578
+ declare const gezel: GezelSDK;
579
+ /**
580
+ * Helper for narrowing `gezel.input` to the exact type derived from a
581
+ * `defineScript` meta. Pure type-level alias — nothing to call at
582
+ * runtime. Scripts that want full input typing can do:
583
+ *
584
+ * const input = gezel.input as InferredInput<typeof meta>;
585
+ */
586
+ type InferredInput<M> = M extends ScriptMeta<infer I, infer _O> ? InferInput<I> : never;
587
+ type InferredOutput<M> = M extends ScriptMeta<infer _I, infer O> ? InferOutput<O> : never;
588
+
589
+ export { type ArtifactEntry, type AuthedHttpOpts, type AuthedHttpResponse, type DocumentEntry, type FsEntry, type FsStat, type GezelSDK, type HttpRequestOpts, type HttpResponse, InferInput, InferOutput, type InferredInput, type InferredOutput, type OneShotOpts, ScriptInputs, ScriptMeta, ScriptOutputs, type ScriptResult, type TaskNote, type TaskNoteAuthor, type TaskStep, defineScript, gezel };