@ikenga/contract 0.5.0 → 0.6.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.
- package/dist/browser.d.ts +624 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +264 -0
- package/dist/browser.js.map +1 -0
- package/dist/engine/acp.d.ts +271 -0
- package/dist/engine/acp.d.ts.map +1 -0
- package/dist/engine/acp.js +13 -0
- package/dist/engine/acp.js.map +1 -0
- package/dist/{engine.d.ts → engine/adapter.d.ts} +60 -243
- package/dist/engine/adapter.d.ts.map +1 -0
- package/dist/{engine.js → engine/adapter.js} +14 -6
- package/dist/engine/adapter.js.map +1 -0
- package/dist/engine/errors.d.ts +17 -0
- package/dist/engine/errors.d.ts.map +1 -0
- package/dist/engine/errors.js +19 -0
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/index.d.ts +12 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +12 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +147 -0
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +32 -1
- package/dist/manifest.js.map +1 -1
- package/dist/registry.d.ts +216 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +23 -0
- package/dist/registry.js.map +1 -1
- package/dist/rpc.d.ts +1 -1
- package/dist/rpc.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/browser.test.ts +350 -0
- package/src/browser.ts +364 -0
- package/src/{engine.ts → engine/acp.ts} +49 -198
- package/src/engine/adapter.ts +243 -0
- package/src/{engine.test.ts → engine/engine.test.ts} +33 -2
- package/src/engine/errors.ts +20 -0
- package/src/engine/index.ts +12 -0
- package/src/index.ts +2 -1
- package/src/manifest.ts +35 -1
- package/src/registry.ts +25 -0
- package/src/rpc.ts +1 -1
- package/dist/engine.d.ts.map +0 -1
- package/dist/engine.js.map +0 -1
|
@@ -1,16 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy Engine adapter shape. New adapters target `./acp.ts`. Both are
|
|
3
|
+
* exported through `@ikenga/contract/engine` during the deprecation cycle.
|
|
4
|
+
*
|
|
5
|
+
* Engine adapter contract. Implementations:
|
|
6
|
+
* - engine-claude-code (default, ships preinstalled)
|
|
7
|
+
* - engine-codex (future)
|
|
8
|
+
* - engine-aider (future)
|
|
9
|
+
* - engine-noop (testing / shell-without-AI mode)
|
|
10
|
+
*
|
|
11
|
+
* @deprecated Phase 11 retires this surface. New adapters target the ACP
|
|
12
|
+
* shape in `./acp.ts` (`AcpEngine`, `createAcpEngine`, `AcpHost`).
|
|
13
|
+
*/
|
|
1
14
|
import { z } from 'zod';
|
|
15
|
+
/** @deprecated Use the ACP shape in `./acp.ts`. */
|
|
2
16
|
export interface SessionOpts {
|
|
3
17
|
cwd?: string;
|
|
4
18
|
systemPrompt?: string;
|
|
5
19
|
toolAllowList?: string[];
|
|
6
20
|
/** Caller pkg id, used by the engine for per-pkg billing/audit. */
|
|
7
21
|
callerPkg?: string;
|
|
22
|
+
/** Model override for the session (adapter-specific). */
|
|
23
|
+
model?: string;
|
|
24
|
+
/** Resume a prior session by id (adapter-specific; requires sessionResume cap). */
|
|
25
|
+
resumeSessionId?: string;
|
|
8
26
|
}
|
|
27
|
+
/** @deprecated Use the ACP shape in `./acp.ts`. */
|
|
9
28
|
export interface Session {
|
|
10
29
|
readonly id: string;
|
|
11
30
|
/** Best-effort cancellation. Resolves once the engine has stopped streaming. */
|
|
12
31
|
cancel(): Promise<void>;
|
|
13
32
|
}
|
|
33
|
+
/** @deprecated Use `AcpSessionUpdate` from `./acp.ts`. */
|
|
14
34
|
export type EngineEvent = {
|
|
15
35
|
type: 'message_delta';
|
|
16
36
|
text: string;
|
|
@@ -38,6 +58,11 @@ export type EngineEvent = {
|
|
|
38
58
|
reason: 'stop' | 'cancel' | 'error';
|
|
39
59
|
error?: string;
|
|
40
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* MCP server spec. Shared between the legacy `Engine` surface and the ACP
|
|
63
|
+
* `newSession` request — not marked `@deprecated` because the ACP shape
|
|
64
|
+
* reuses it verbatim.
|
|
65
|
+
*/
|
|
41
66
|
export interface McpServerSpec {
|
|
42
67
|
id: string;
|
|
43
68
|
command: string;
|
|
@@ -275,6 +300,39 @@ export declare const EngineProvidesSchema: z.ZodObject<{
|
|
|
275
300
|
} | undefined;
|
|
276
301
|
}>;
|
|
277
302
|
export type EngineProvides = z.infer<typeof EngineProvidesSchema>;
|
|
303
|
+
/**
|
|
304
|
+
* Static metadata every adapter surfaces via `Engine.metadata`. Mirrors the
|
|
305
|
+
* manifest's `engine` block so the shell + wizard can introspect without
|
|
306
|
+
* re-parsing the manifest.
|
|
307
|
+
*/
|
|
308
|
+
export interface EngineMetadata {
|
|
309
|
+
agentId: string;
|
|
310
|
+
display: string;
|
|
311
|
+
capabilities: AgentCapabilities;
|
|
312
|
+
onboarding: EngineOnboarding;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Tauri-command surface the host shell exposes to legacy `Engine` adapters.
|
|
316
|
+
* The shell binds these names to its `claude_chat_*` commands; adapters
|
|
317
|
+
* never call `invoke()` directly so they remain testable.
|
|
318
|
+
*
|
|
319
|
+
* @deprecated Use the ACP shape (`AcpHost` in `./acp.ts`) for new adapters.
|
|
320
|
+
*/
|
|
321
|
+
export interface HostBridge {
|
|
322
|
+
spawn(opts: {
|
|
323
|
+
sessionId: string;
|
|
324
|
+
cwd?: string;
|
|
325
|
+
systemPrompt?: string;
|
|
326
|
+
model?: string;
|
|
327
|
+
resumeSessionId?: string;
|
|
328
|
+
}): Promise<void>;
|
|
329
|
+
send(sessionId: string, message: string): Promise<void>;
|
|
330
|
+
kill(sessionId: string): Promise<void>;
|
|
331
|
+
listen(sessionId: string): AsyncIterable<EngineEvent>;
|
|
332
|
+
registerMcp(spec: McpServerSpec): Promise<void>;
|
|
333
|
+
unregisterMcp(id: string): Promise<void>;
|
|
334
|
+
}
|
|
335
|
+
/** @deprecated Use `AcpEngine` from `./acp.ts`. Legacy shape retired in Phase 11. */
|
|
278
336
|
export interface Engine {
|
|
279
337
|
/** Stable identifier — matches the pkg id of the engine adapter. */
|
|
280
338
|
readonly id: string;
|
|
@@ -286,12 +344,7 @@ export interface Engine {
|
|
|
286
344
|
* / onboarding so the shell and wizard can introspect without re-parsing
|
|
287
345
|
* the manifest.
|
|
288
346
|
*/
|
|
289
|
-
readonly metadata:
|
|
290
|
-
agentId: string;
|
|
291
|
-
display: string;
|
|
292
|
-
capabilities: AgentCapabilities;
|
|
293
|
-
onboarding: EngineOnboarding;
|
|
294
|
-
};
|
|
347
|
+
readonly metadata: EngineMetadata;
|
|
295
348
|
/** Open a new session. Sessions are cheap; create one per pkg invocation. */
|
|
296
349
|
startSession(opts: SessionOpts): Promise<Session>;
|
|
297
350
|
/** Send input and stream events. The iterable completes on `done`. */
|
|
@@ -335,240 +388,4 @@ export interface AdapterLoader {
|
|
|
335
388
|
*/
|
|
336
389
|
fallback(): Engine;
|
|
337
390
|
}
|
|
338
|
-
|
|
339
|
-
export type AcpProtocolVersion = number;
|
|
340
|
-
export interface AcpInitializeRequest {
|
|
341
|
-
protocolVersion: AcpProtocolVersion;
|
|
342
|
-
/** Optional `_meta` passthrough; the in-process shell ignores it. */
|
|
343
|
-
_meta?: Record<string, unknown>;
|
|
344
|
-
}
|
|
345
|
-
export interface AcpPromptCapabilities {
|
|
346
|
-
image: boolean;
|
|
347
|
-
audio: boolean;
|
|
348
|
-
embeddedContext: boolean;
|
|
349
|
-
}
|
|
350
|
-
export interface AcpMcpCapabilities {
|
|
351
|
-
http: boolean;
|
|
352
|
-
sse: boolean;
|
|
353
|
-
}
|
|
354
|
-
export interface AcpAgentCapabilities {
|
|
355
|
-
loadSession: boolean;
|
|
356
|
-
promptCapabilities: AcpPromptCapabilities;
|
|
357
|
-
mcpCapabilities: AcpMcpCapabilities;
|
|
358
|
-
}
|
|
359
|
-
export interface AcpInitializeResponse {
|
|
360
|
-
protocolVersion: AcpProtocolVersion;
|
|
361
|
-
agentCapabilities: AcpAgentCapabilities;
|
|
362
|
-
/** Authentication methods the agent supports — opaque structure passed
|
|
363
|
-
* through to the wizard. */
|
|
364
|
-
authMethods?: unknown[];
|
|
365
|
-
_meta?: Record<string, unknown>;
|
|
366
|
-
}
|
|
367
|
-
export interface AcpTextContentBlock {
|
|
368
|
-
type: 'text';
|
|
369
|
-
text: string;
|
|
370
|
-
}
|
|
371
|
-
/** ACP `ContentBlock::Image`. `data` is raw base64 with NO `data:` URI prefix. */
|
|
372
|
-
export interface AcpImageContentBlock {
|
|
373
|
-
type: 'image';
|
|
374
|
-
data: string;
|
|
375
|
-
mimeType: string;
|
|
376
|
-
uri?: string;
|
|
377
|
-
}
|
|
378
|
-
export type AcpContentBlock = AcpTextContentBlock | AcpImageContentBlock | {
|
|
379
|
-
type: 'audio';
|
|
380
|
-
data: string;
|
|
381
|
-
mimeType: string;
|
|
382
|
-
} | {
|
|
383
|
-
type: 'resource_link';
|
|
384
|
-
name: string;
|
|
385
|
-
uri: string;
|
|
386
|
-
} | {
|
|
387
|
-
type: 'resource';
|
|
388
|
-
resource: unknown;
|
|
389
|
-
};
|
|
390
|
-
export interface AcpNewSessionRequest {
|
|
391
|
-
cwd: string;
|
|
392
|
-
mcpServers: McpServerSpec[];
|
|
393
|
-
_meta?: Record<string, unknown>;
|
|
394
|
-
}
|
|
395
|
-
/** The four canonical ACP session modes the Rust ACP server advertises. */
|
|
396
|
-
export type AcpSessionModeId = 'plan' | 'default' | 'auto' | 'bypassPermissions';
|
|
397
|
-
export interface AcpSessionMode {
|
|
398
|
-
id: AcpSessionModeId;
|
|
399
|
-
name: string;
|
|
400
|
-
description?: string;
|
|
401
|
-
_meta?: Record<string, unknown>;
|
|
402
|
-
}
|
|
403
|
-
export interface AcpSessionModes {
|
|
404
|
-
currentModeId: AcpSessionModeId;
|
|
405
|
-
availableModes: AcpSessionMode[];
|
|
406
|
-
_meta?: Record<string, unknown>;
|
|
407
|
-
}
|
|
408
|
-
export interface AcpNewSessionResponse {
|
|
409
|
-
sessionId: string;
|
|
410
|
-
modes?: AcpSessionModes;
|
|
411
|
-
models?: unknown;
|
|
412
|
-
configOptions?: unknown[];
|
|
413
|
-
_meta?: Record<string, unknown>;
|
|
414
|
-
}
|
|
415
|
-
export interface AcpPromptRequest {
|
|
416
|
-
sessionId: string;
|
|
417
|
-
prompt: AcpContentBlock[];
|
|
418
|
-
messageId?: string;
|
|
419
|
-
_meta?: Record<string, unknown>;
|
|
420
|
-
}
|
|
421
|
-
export type AcpStopReason = 'end_turn' | 'max_tokens' | 'max_turn_requests' | 'refusal' | 'cancelled';
|
|
422
|
-
export interface AcpPromptResponse {
|
|
423
|
-
stopReason: AcpStopReason;
|
|
424
|
-
userMessageId?: string;
|
|
425
|
-
usage?: unknown;
|
|
426
|
-
_meta?: Record<string, unknown>;
|
|
427
|
-
}
|
|
428
|
-
/** ACP `SessionUpdate` discriminated union. Open-ended on the `string` tail
|
|
429
|
-
* so adapter-specific extensions don't break TS consumers. */
|
|
430
|
-
export type AcpSessionUpdate = {
|
|
431
|
-
sessionUpdate: 'agent_message_chunk';
|
|
432
|
-
content: AcpContentBlock;
|
|
433
|
-
messageId?: string;
|
|
434
|
-
} | {
|
|
435
|
-
sessionUpdate: 'agent_thought_chunk';
|
|
436
|
-
content: AcpContentBlock;
|
|
437
|
-
messageId?: string;
|
|
438
|
-
} | {
|
|
439
|
-
sessionUpdate: 'user_message_chunk';
|
|
440
|
-
content: AcpContentBlock;
|
|
441
|
-
} | {
|
|
442
|
-
sessionUpdate: 'tool_call';
|
|
443
|
-
toolCallId: string;
|
|
444
|
-
title: string;
|
|
445
|
-
kind?: string;
|
|
446
|
-
status?: string;
|
|
447
|
-
content?: unknown[];
|
|
448
|
-
rawInput?: unknown;
|
|
449
|
-
_meta?: Record<string, unknown>;
|
|
450
|
-
} | {
|
|
451
|
-
sessionUpdate: 'tool_call_update';
|
|
452
|
-
toolCallId: string;
|
|
453
|
-
fields: {
|
|
454
|
-
status?: string;
|
|
455
|
-
content?: unknown[];
|
|
456
|
-
rawOutput?: unknown;
|
|
457
|
-
};
|
|
458
|
-
_meta?: Record<string, unknown>;
|
|
459
|
-
} | {
|
|
460
|
-
sessionUpdate: 'current_mode_update';
|
|
461
|
-
currentModeId: AcpSessionModeId;
|
|
462
|
-
} | {
|
|
463
|
-
sessionUpdate: 'plan_update';
|
|
464
|
-
plan: unknown;
|
|
465
|
-
} | {
|
|
466
|
-
sessionUpdate: string;
|
|
467
|
-
[k: string]: unknown;
|
|
468
|
-
};
|
|
469
|
-
export interface AcpSessionNotification {
|
|
470
|
-
sessionId: string;
|
|
471
|
-
update: AcpSessionUpdate;
|
|
472
|
-
_meta?: Record<string, unknown>;
|
|
473
|
-
}
|
|
474
|
-
export type AcpPermissionOptionKind = 'allow_once' | 'allow_always' | 'reject_once' | 'reject_always';
|
|
475
|
-
export interface AcpPermissionOption {
|
|
476
|
-
optionId: string;
|
|
477
|
-
name: string;
|
|
478
|
-
kind: AcpPermissionOptionKind;
|
|
479
|
-
}
|
|
480
|
-
export interface AcpToolCallSummary {
|
|
481
|
-
toolCallId: string;
|
|
482
|
-
title?: string;
|
|
483
|
-
kind?: string;
|
|
484
|
-
status?: string;
|
|
485
|
-
content?: unknown[];
|
|
486
|
-
rawInput?: unknown;
|
|
487
|
-
rawOutput?: unknown;
|
|
488
|
-
}
|
|
489
|
-
export interface AcpRequestPermissionRequest {
|
|
490
|
-
sessionId: string;
|
|
491
|
-
toolCall: AcpToolCallSummary;
|
|
492
|
-
options: AcpPermissionOption[];
|
|
493
|
-
_meta?: Record<string, unknown>;
|
|
494
|
-
}
|
|
495
|
-
export type AcpRequestPermissionOutcome = {
|
|
496
|
-
outcome: 'cancelled';
|
|
497
|
-
} | {
|
|
498
|
-
outcome: 'selected';
|
|
499
|
-
optionId: string;
|
|
500
|
-
};
|
|
501
|
-
export interface AcpRequestPermissionResponse {
|
|
502
|
-
outcome: AcpRequestPermissionOutcome;
|
|
503
|
-
_meta?: Record<string, unknown>;
|
|
504
|
-
}
|
|
505
|
-
/** Wire envelope: pairs a `requestId` with the request body so the client
|
|
506
|
-
* reply can address the parked Rust-side oneshot. */
|
|
507
|
-
export interface AcpPermissionRequestEnvelope {
|
|
508
|
-
requestId: string;
|
|
509
|
-
request: AcpRequestPermissionRequest;
|
|
510
|
-
}
|
|
511
|
-
export interface AcpLoadSessionResponse {
|
|
512
|
-
/** Optional mode advertisement so the picker can hydrate without paying
|
|
513
|
-
* the cold-spawn cost of `newSession`. */
|
|
514
|
-
modes?: AcpSessionModes;
|
|
515
|
-
}
|
|
516
|
-
export interface AcpForkResult {
|
|
517
|
-
newThreadId: string;
|
|
518
|
-
sourceThreadId: string;
|
|
519
|
-
branchedFromTurn?: number;
|
|
520
|
-
}
|
|
521
|
-
export interface AcpForkOpts {
|
|
522
|
-
upToTurn?: number;
|
|
523
|
-
label?: string;
|
|
524
|
-
}
|
|
525
|
-
export type AcpNotifyKind = 'notification' | 'permissionRequest';
|
|
526
|
-
export interface AcpNotifyPayload {
|
|
527
|
-
threadId: string;
|
|
528
|
-
title: string;
|
|
529
|
-
body: string;
|
|
530
|
-
kind: AcpNotifyKind;
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* ACP-shaped engine adapter. Implementations:
|
|
534
|
-
* - `pkgs/engine-claude-code` — wraps the in-process Rust ACP server.
|
|
535
|
-
* - future: `pkgs/engine-codex`, `pkgs/engine-aider` — each speaking the
|
|
536
|
-
* same wire shapes.
|
|
537
|
-
*
|
|
538
|
-
* Method names mirror ACP verbatim (`newSession`, `prompt`, `cancel`,
|
|
539
|
-
* `setMode`, `loadSession`, `forkSession`, `respondPermission`) so the wire
|
|
540
|
-
* layer, adapter layer, and host shell share one vocabulary.
|
|
541
|
-
*
|
|
542
|
-
* Subscriptions return a synchronous `() => void` unsubscribe — the
|
|
543
|
-
* implementation may resolve the underlying tauri-listener asynchronously
|
|
544
|
-
* but the caller can drop the registration immediately on unmount.
|
|
545
|
-
*/
|
|
546
|
-
export interface AcpEngine {
|
|
547
|
-
initialize(req: AcpInitializeRequest): Promise<AcpInitializeResponse>;
|
|
548
|
-
/** Mint a new session. The agent may lazily spawn its child on the first
|
|
549
|
-
* `prompt` rather than during `newSession` itself. */
|
|
550
|
-
newSession(req: AcpNewSessionRequest): Promise<AcpNewSessionResponse>;
|
|
551
|
-
/** Send a turn. Resolves when the turn ends; in-progress events flow via
|
|
552
|
-
* `onSessionUpdate`. */
|
|
553
|
-
prompt(req: AcpPromptRequest): Promise<AcpPromptResponse>;
|
|
554
|
-
/** Clean interrupt. Preserves the transcript and keeps the child alive
|
|
555
|
-
* for the next turn. */
|
|
556
|
-
cancel(sessionId: string): Promise<void>;
|
|
557
|
-
/** Switch the session's permission mode. */
|
|
558
|
-
setMode(sessionId: string, modeId: AcpSessionModeId): Promise<void>;
|
|
559
|
-
/** Re-attach to an existing session by id. The child stays lazy. */
|
|
560
|
-
loadSession(sessionId: string): Promise<AcpLoadSessionResponse>;
|
|
561
|
-
/** Clone a session from a chosen turn. The new thread inherits the source's
|
|
562
|
-
* on-disk transcript so the first prompt resumes from the cutoff. */
|
|
563
|
-
forkSession(sourceSessionId: string, opts?: AcpForkOpts): Promise<AcpForkResult>;
|
|
564
|
-
/** Subscribe to session updates. Returns a sync unsubscribe. */
|
|
565
|
-
onSessionUpdate(sessionId: string, callback: (update: AcpSessionUpdate) => void): () => void;
|
|
566
|
-
/** Subscribe to permission requests for this session. Reply via
|
|
567
|
-
* `respondPermission`. Returns a sync unsubscribe. */
|
|
568
|
-
onPermissionRequest(sessionId: string, callback: (envelope: AcpPermissionRequestEnvelope) => void): () => void;
|
|
569
|
-
/** Reply to a parked permission request. */
|
|
570
|
-
respondPermission(requestId: string, response: AcpRequestPermissionResponse): Promise<void>;
|
|
571
|
-
/** Subscribe to OS-attention notifications. Returns a sync unsubscribe. */
|
|
572
|
-
onNotify(callback: (payload: AcpNotifyPayload) => void): () => void;
|
|
573
|
-
}
|
|
574
|
-
//# sourceMappingURL=engine.d.ts.map
|
|
391
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/engine/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,mDAAmD;AACnD,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAC9E;IAAE,IAAI,EAAE,gBAAgB,CAAC;IA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-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Legacy Engine adapter shape. New adapters target `./acp.ts`. Both are
|
|
3
|
+
* exported through `@ikenga/contract/engine` during the deprecation cycle.
|
|
4
|
+
*
|
|
5
|
+
* Engine adapter contract. Implementations:
|
|
6
|
+
* - engine-claude-code (default, ships preinstalled)
|
|
7
|
+
* - engine-codex (future)
|
|
8
|
+
* - engine-aider (future)
|
|
9
|
+
* - engine-noop (testing / shell-without-AI mode)
|
|
10
|
+
*
|
|
11
|
+
* @deprecated Phase 11 retires this surface. New adapters target the ACP
|
|
12
|
+
* shape in `./acp.ts` (`AcpEngine`, `createAcpEngine`, `AcpHost`).
|
|
13
|
+
*/
|
|
6
14
|
import { z } from 'zod';
|
|
7
15
|
// ---------- Capabilities (single source of truth) ----------
|
|
8
16
|
/**
|
|
@@ -82,4 +90,4 @@ export const EngineProvidesSchema = z.object({
|
|
|
82
90
|
requiredEnvVars: [],
|
|
83
91
|
}),
|
|
84
92
|
});
|
|
85
|
-
//# sourceMappingURL=
|
|
93
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/engine/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2CxB,8DAA8D;AAE9D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,kEAAkE;IAClE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,6DAA6D;IAC7D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,2EAA2E;IAC3E,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,mFAAmF;IACnF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,oDAAoD;IACpD,eAAe,EAAE,C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AY,EAAE,uBAAuB;IACrC,sDAAsD;IACtD,UAAU,EAAE,sBAAsB,CAAC,OAAO,CAAC;QACzC,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,EAAE;KACpB,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared error types for engine adapters.
|
|
3
|
+
*
|
|
4
|
+
* Stub adapters (e.g. `engine-codex`, `engine-gemini`) detect a CLI on the
|
|
5
|
+
* host but don't yet implement `send` / `prompt`. They throw
|
|
6
|
+
* `EngineNotImplementedError` so the shell can render an actionable
|
|
7
|
+
* onboarding hint (the optional `docsUrl`) instead of a generic crash.
|
|
8
|
+
*/
|
|
9
|
+
export declare class EngineNotImplementedError extends Error {
|
|
10
|
+
readonly engineId: string;
|
|
11
|
+
readonly docsUrl?: string;
|
|
12
|
+
constructor(engineId: string, opts?: {
|
|
13
|
+
docsUrl?: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/engine/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;gBAEd,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAM5E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared error types for engine adapters.
|
|
3
|
+
*
|
|
4
|
+
* Stub adapters (e.g. `engine-codex`, `engine-gemini`) detect a CLI on the
|
|
5
|
+
* host but don't yet implement `send` / `prompt`. They throw
|
|
6
|
+
* `EngineNotImplementedError` so the shell can render an actionable
|
|
7
|
+
* onboarding hint (the optional `docsUrl`) instead of a generic crash.
|
|
8
|
+
*/
|
|
9
|
+
export class EngineNotImplementedError extends Error {
|
|
10
|
+
engineId;
|
|
11
|
+
docsUrl;
|
|
12
|
+
constructor(engineId, opts) {
|
|
13
|
+
super(opts?.message ?? `Engine ${engineId} is not implemented yet`);
|
|
14
|
+
this.name = 'EngineNotImplementedError';
|
|
15
|
+
this.engineId = engineId;
|
|
16
|
+
this.docsUrl = opts?.docsUrl;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/engine/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,QAAQ,CAAS;IACjB,OAAO,CAAU;IAE1B,YAAY,QAAgB,EAAE,IAA6C;QACzE,KAAK,CAAC,IAAI,EAAE,OAAO,IAAI,UAAU,QAAQ,yBAAyB,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@ikenga/contract/engine` — engine adapter surface.
|
|
3
|
+
*
|
|
4
|
+
* Exports BOTH the legacy `Engine` shape (`./adapter`) and the ACP-shaped
|
|
5
|
+
* surface (`./acp`) side-by-side for one deprecation cycle. Legacy types
|
|
6
|
+
* carry `@deprecated` JSDoc pointing at the ACP path. Shared error types
|
|
7
|
+
* live in `./errors`.
|
|
8
|
+
*/
|
|
9
|
+
export * from './adapter.js';
|
|
10
|
+
export * from './acp.js';
|
|
11
|
+
export * from './errors.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@ikenga/contract/engine` — engine adapter surface.
|
|
3
|
+
*
|
|
4
|
+
* Exports BOTH the legacy `Engine` shape (`./adapter`) and the ACP-shaped
|
|
5
|
+
* surface (`./acp`) side-by-side for one deprecation cycle. Legacy types
|
|
6
|
+
* carry `@deprecated` JSDoc pointing at the ACP path. Shared error types
|
|
7
|
+
* live in `./errors`.
|
|
8
|
+
*/
|
|
9
|
+
export * from './adapter.js';
|
|
10
|
+
export * from './acp.js';
|
|
11
|
+
export * from './errors.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export * from './manifest.js';
|
|
2
2
|
export * from './rpc.js';
|
|
3
|
-
export * from './engine.js';
|
|
3
|
+
export * from './engine/index.js';
|
|
4
4
|
export * from './scopes.js';
|
|
5
5
|
export * from './iyke.js';
|
|
6
6
|
export * from './artifact.js';
|
|
7
7
|
export * from './registry.js';
|
|
8
|
+
export * from './browser.js';
|
|
8
9
|
/** This package's own version. */
|
|
9
10
|
export declare const CONTRACT_PACKAGE_VERSION: "0.5.0";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAE7B,kCAAkC;AAClC,eAAO,MAAM,wBAAwB,EAAG,OAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export * from './manifest.js';
|
|
2
2
|
export * from './rpc.js';
|
|
3
|
-
export * from './engine.js';
|
|
3
|
+
export * from './engine/index.js';
|
|
4
4
|
export * from './scopes.js';
|
|
5
5
|
export * from './iyke.js';
|
|
6
6
|
export * from './artifact.js';
|
|
7
7
|
export * from './registry.js';
|
|
8
|
+
export * from './browser.js';
|
|
8
9
|
/** This package's own version. */
|
|
9
10
|
export const CONTRACT_PACKAGE_VERSION = '0.5.0';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAE7B,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAgB,CAAC"}
|