indusagi-coding-agent 0.1.43 → 0.1.44
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 +10 -1
- package/dist/command-line/list-models.js +1 -1
- package/dist/command-line/list-models.js.map +1 -1
- package/dist/command-line/login-handler.d.ts.map +1 -1
- package/dist/command-line/login-handler.js +32 -0
- package/dist/command-line/login-handler.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/induscode-ui-delegate.d.ts +3 -0
- package/dist/interfaces/induscode-ui-delegate.d.ts.map +1 -0
- package/dist/interfaces/induscode-ui-delegate.js +148 -0
- package/dist/interfaces/induscode-ui-delegate.js.map +1 -0
- package/dist/interfaces/terminal-ui/components/footer.d.ts.map +1 -1
- package/dist/interfaces/terminal-ui/components/footer.js +9 -15
- package/dist/interfaces/terminal-ui/components/footer.js.map +1 -1
- package/dist/interfaces/terminal-ui/components/model-selector.d.ts.map +1 -1
- package/dist/interfaces/terminal-ui/components/model-selector.js +1 -1
- package/dist/interfaces/terminal-ui/components/model-selector.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/runtime/agent-session.d.ts +4 -0
- package/dist/runtime/agent-session.d.ts.map +1 -1
- package/dist/runtime/agent-session.js +53 -22
- package/dist/runtime/agent-session.js.map +1 -1
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/model-registry.d.ts +6 -0
- package/dist/runtime/model-registry.d.ts.map +1 -1
- package/dist/runtime/model-registry.js +71 -14
- package/dist/runtime/model-registry.js.map +1 -1
- package/dist/runtime/model-resolver.d.ts.map +1 -1
- package/dist/runtime/model-resolver.js +5 -3
- package/dist/runtime/model-resolver.js.map +1 -1
- package/dist/runtime/plugins/types.d.ts +3 -0
- package/dist/runtime/plugins/types.d.ts.map +1 -1
- package/dist/runtime/plugins/types.js.map +1 -1
- package/dist/runtime/providers/adapters/claude-cli-adapter.d.ts +19 -0
- package/dist/runtime/providers/adapters/claude-cli-adapter.d.ts.map +1 -0
- package/dist/runtime/providers/adapters/claude-cli-adapter.js +242 -0
- package/dist/runtime/providers/adapters/claude-cli-adapter.js.map +1 -0
- package/dist/runtime/providers/adapters/codex-cli-adapter.d.ts +18 -0
- package/dist/runtime/providers/adapters/codex-cli-adapter.d.ts.map +1 -0
- package/dist/runtime/providers/adapters/codex-cli-adapter.js +177 -0
- package/dist/runtime/providers/adapters/codex-cli-adapter.js.map +1 -0
- package/dist/runtime/providers/adapters/indusagi-cli-adapter.d.ts +21 -0
- package/dist/runtime/providers/adapters/indusagi-cli-adapter.d.ts.map +1 -0
- package/dist/runtime/providers/adapters/indusagi-cli-adapter.js +162 -0
- package/dist/runtime/providers/adapters/indusagi-cli-adapter.js.map +1 -0
- package/dist/runtime/providers/adapters/utils.d.ts +12 -0
- package/dist/runtime/providers/adapters/utils.d.ts.map +1 -0
- package/dist/runtime/providers/adapters/utils.js +122 -0
- package/dist/runtime/providers/adapters/utils.js.map +1 -0
- package/dist/runtime/providers/builtins.d.ts +3 -0
- package/dist/runtime/providers/builtins.d.ts.map +1 -0
- package/dist/runtime/providers/builtins.js +99 -0
- package/dist/runtime/providers/builtins.js.map +1 -0
- package/dist/runtime/providers/provider-adapter-registry.d.ts +11 -0
- package/dist/runtime/providers/provider-adapter-registry.d.ts.map +1 -0
- package/dist/runtime/providers/provider-adapter-registry.js +36 -0
- package/dist/runtime/providers/provider-adapter-registry.js.map +1 -0
- package/dist/runtime/providers/provider-adapter.d.ts +33 -0
- package/dist/runtime/providers/provider-adapter.d.ts.map +1 -0
- package/dist/runtime/providers/provider-adapter.js +2 -0
- package/dist/runtime/providers/provider-adapter.js.map +1 -0
- package/dist/runtime/providers/provider-service.d.ts +33 -0
- package/dist/runtime/providers/provider-service.d.ts.map +1 -0
- package/dist/runtime/providers/provider-service.js +157 -0
- package/dist/runtime/providers/provider-service.js.map +1 -0
- package/dist/runtime/providers/types.d.ts +29 -0
- package/dist/runtime/providers/types.d.ts.map +1 -0
- package/dist/runtime/providers/types.js +9 -0
- package/dist/runtime/providers/types.js.map +1 -0
- package/dist/runtime/sdk.d.ts +4 -0
- package/dist/runtime/sdk.d.ts.map +1 -1
- package/dist/runtime/sdk.js +38 -4
- package/dist/runtime/sdk.js.map +1 -1
- package/dist/telemetry/core/types.d.ts +1 -1
- package/dist/telemetry/core/types.js +1 -1
- package/guides/CLAUDE_CODEX_CLI_INTEGRATION_PLAN.md +321 -0
- package/guides/{PI_MONO_MIT_REMOVAL_GUIDE.md → INDUSAGI_MONO_MIT_REMOVAL_GUIDE.md} +29 -29
- package/guides/OPTION3_PROVIDER_ADAPTER_RUNTIME_PLAN.md +370 -0
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Indusagi Mono MIT Removal Guide for `indusagi-screth`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
> **Important:** This is a technical provenance-cleanup guide, **not legal advice**. If you want to make a strong public claim like _"`indusagi-screth` contains no
|
|
5
|
+
> **Important:** This is a technical provenance-cleanup guide, **not legal advice**. If you want to make a strong public claim like _"`indusagi-screth` contains no Indusagi Mono derived code"_, you should still do a final legal/provenance review.
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -10,21 +10,21 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
If the goal is to make `indusagi-screth` **
|
|
13
|
+
If the goal is to make `indusagi-screth` **Indusagi Mono MIT-free**, the safe standard is:ß
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
1. No copied
|
|
17
|
+
1. No copied Indusagi Mono source files remain.
|
|
18
18
|
|
|
19
|
-
2. No adapted/derived
|
|
19
|
+
2. No adapted/derived Indusagi Mono files remain unless you are willing to keep MIT attribution.
|
|
20
20
|
|
|
21
21
|
3. Third-party vendor assets are either:
|
|
22
22
|
|
|
23
23
|
- replaced by direct upstream package installation/build steps, or
|
|
24
24
|
|
|
25
|
-
- kept with their own proper attribution, independent of
|
|
25
|
+
- kept with their own proper attribution, independent of Indusagi Mono.
|
|
26
26
|
|
|
27
|
-
4. Documentation, package metadata, and marketing text do not imply
|
|
27
|
+
4. Documentation, package metadata, and marketing text do not imply Indusagi Mono-derived implementation if that is no longer true.
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -34,7 +34,7 @@ If the goal is to make `indusagi-screth` **PI Mono MIT-free**, the safe standard
|
|
|
34
34
|
|
|
35
35
|
Compared repos:
|
|
36
36
|
|
|
37
|
-
- `@
|
|
37
|
+
- `@indusagi-mono/packages/coding-agent/`
|
|
38
38
|
|
|
39
39
|
- `@indusagi-screth/`
|
|
40
40
|
|
|
@@ -50,7 +50,7 @@ Current overlap snapshot:
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
That means `indusagi-screth` is **not** currently in a position where it is safe to say _"
|
|
53
|
+
That means `indusagi-screth` is **not** currently in a position where it is safe to say _"Indusagi Mono copyright does not apply"_. There is still enough exact and likely-derived overlap that a cleanup pass is required.
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
@@ -70,7 +70,7 @@ Before rewriting anything, follow these rules:
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
- Do **not** use
|
|
73
|
+
- Do **not** use Indusagi Mono files as copy-paste sources during the rewrite.
|
|
74
74
|
|
|
75
75
|
- Rewrite from behavior/specification, not from line-by-line adaptation.
|
|
76
76
|
|
|
@@ -82,7 +82,7 @@ Before rewriting anything, follow these rules:
|
|
|
82
82
|
|
|
83
83
|
- `kept and MIT attribution retained`
|
|
84
84
|
|
|
85
|
-
- If a file is still
|
|
85
|
+
- If a file is still Indusagi Mono-derived after cleanup, keep MIT attribution for that file/subtree.
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
|
|
@@ -94,7 +94,7 @@ Before rewriting anything, follow these rules:
|
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
These are the highest-risk files because they currently match
|
|
97
|
+
These are the highest-risk files because they currently match Indusagi Mono exactly.
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
|
|
@@ -118,7 +118,7 @@ These are the highest-risk files because they currently match PI Mono exactly.
|
|
|
118
118
|
|
|
119
119
|
### P1-B. Exact vendor / asset files to replace properly
|
|
120
120
|
|
|
121
|
-
These should not stay as copied repo assets if the goal is "
|
|
121
|
+
These should not stay as copied repo assets if the goal is "Indusagi Mono MIT-free provenance".
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
@@ -136,7 +136,7 @@ For each file above, do one of:
|
|
|
136
136
|
|
|
137
137
|
- full independent rewrite, or
|
|
138
138
|
|
|
139
|
-
- replace from original upstream package/source with proper direct attribution, not via
|
|
139
|
+
- replace from original upstream package/source with proper direct attribution, not via Indusagi Mono copy.
|
|
140
140
|
|
|
141
141
|
### P1 status update
|
|
142
142
|
|
|
@@ -308,7 +308,7 @@ These should **not** be hand-edited.
|
|
|
308
308
|
- new control-flow shape
|
|
309
309
|
- new intermediate data model
|
|
310
310
|
- same behavior implemented through a different code path
|
|
311
|
-
- vendor assets replaced from direct upstream instead of
|
|
311
|
+
- vendor assets replaced from direct upstream instead of Indusagi Mono copies
|
|
312
312
|
|
|
313
313
|
|
|
314
314
|
|
|
@@ -410,7 +410,7 @@ These files are not byte-identical, but they share the same path and likely shar
|
|
|
410
410
|
|
|
411
411
|
### Why P2 is critical
|
|
412
412
|
|
|
413
|
-
If these remain structurally
|
|
413
|
+
If these remain structurally Indusagi Mono-derived, then even rewriting surface docs or utilities will not materially change provenance risk.
|
|
414
414
|
|
|
415
415
|
### Focused P2 plan for the currently requested files
|
|
416
416
|
|
|
@@ -418,7 +418,7 @@ If these remain structurally PI Mono-derived, then even rewriting surface docs o
|
|
|
418
418
|
|
|
419
419
|
### Focused P2 post-rewrite recheck (approximate)
|
|
420
420
|
|
|
421
|
-
**Method note:** the percentages below are an approximate **post-P2** recheck against `@
|
|
421
|
+
**Method note:** the percentages below are an approximate **post-P2** recheck against `@indusagi-mono/packages/coding-agent/`, using a `git diff --no-index --word-diff=porcelain` unchanged-text ratio. These numbers are meant for provenance prioritization, not as a legal or plagiarism determination.
|
|
422
422
|
|
|
423
423
|
| File | Post-P2 similarity | Post-P2 difference |
|
|
424
424
|
|---|---:|---:|
|
|
@@ -440,7 +440,7 @@ If these remain structurally PI Mono-derived, then even rewriting surface docs o
|
|
|
440
440
|
|
|
441
441
|
### Focused P2 post-rewrite takeaway
|
|
442
442
|
|
|
443
|
-
This recheck suggests the biggest previously high-similarity P2 files have moved materially away from
|
|
443
|
+
This recheck suggests the biggest previously high-similarity P2 files have moved materially away from Indusagi Mono structure in this batch. In particular:
|
|
444
444
|
|
|
445
445
|
- `src/core/prompt-templates.ts` moved from the earlier near-match risk zone to `30.9%` similarity / `69.1%` difference.
|
|
446
446
|
- `src/core/session-manager.ts` moved from the earlier near-match risk zone to `15.2%` similarity / `84.8%` difference.
|
|
@@ -495,7 +495,7 @@ The files you called out are spread across bootstrap, CLI parsing, runtime orche
|
|
|
495
495
|
|
|
496
496
|
**Minimal but meaningful rewrite:**
|
|
497
497
|
- move MCP log suppression into named helper(s)
|
|
498
|
-
- avoid top-level anonymous patch structure copied from
|
|
498
|
+
- avoid top-level anonymous patch structure copied from Indusagi Mono style
|
|
499
499
|
- introduce a `bootstrapCli()` wrapper that owns process-title + logger patch + main invocation
|
|
500
500
|
|
|
501
501
|
**Suggested rewrite shape:**
|
|
@@ -526,7 +526,7 @@ The files you called out are spread across bootstrap, CLI parsing, runtime orche
|
|
|
526
526
|
- separate package-root detection from exported path helpers
|
|
527
527
|
- centralize env var resolution and tilde expansion
|
|
528
528
|
- group asset path helpers vs user config path helpers vs metadata exports
|
|
529
|
-
- reduce structural resemblance to current
|
|
529
|
+
- reduce structural resemblance to current Indusagi Mono layout even if behavior stays the same
|
|
530
530
|
|
|
531
531
|
**Suggested rewrite shape:**
|
|
532
532
|
- `resolvePackageRoot()`
|
|
@@ -1050,7 +1050,7 @@ Validation after the P3 rewrite pass:
|
|
|
1050
1050
|
|
|
1051
1051
|
### Focused P3 post-rewrite recheck (approximate)
|
|
1052
1052
|
|
|
1053
|
-
**Method note:** the percentages below are an approximate **post-P3** recheck against `@
|
|
1053
|
+
**Method note:** the percentages below are an approximate **post-P3** recheck against `@indusagi-mono/packages/coding-agent/`, using a `git diff --no-index --word-diff=porcelain` unchanged-text ratio. These numbers are meant for provenance prioritization, not as a legal or plagiarism determination.
|
|
1054
1054
|
|
|
1055
1055
|
| File | Post-P3 similarity | Post-P3 difference |
|
|
1056
1056
|
|---|---:|---:|
|
|
@@ -1097,7 +1097,7 @@ So unlike the focused P2 batch, the focused P3 batch is **not yet all below `40%
|
|
|
1097
1097
|
|
|
1098
1098
|
|
|
1099
1099
|
|
|
1100
|
-
These files are many, but they are important because the TUI layer is highly expressive and likely to preserve
|
|
1100
|
+
These files are many, but they are important because the TUI layer is highly expressive and likely to preserve Indusagi Mono structure even after edits. Rewrite after P2/P3.
|
|
1101
1101
|
|
|
1102
1102
|
|
|
1103
1103
|
|
|
@@ -1680,7 +1680,7 @@ That materially changes the repository-wide overlap picture: there are no longer
|
|
|
1680
1680
|
|
|
1681
1681
|
|
|
1682
1682
|
|
|
1683
|
-
These files exist in `indusagi-screth` but not in
|
|
1683
|
+
These files exist in `indusagi-screth` but not in Indusagi Mono, so they are **not immediate Indusagi Mono overlap evidence** based on path comparison alone:
|
|
1684
1684
|
|
|
1685
1685
|
|
|
1686
1686
|
|
|
@@ -1716,7 +1716,7 @@ These files exist in `indusagi-screth` but not in PI Mono, so they are **not imm
|
|
|
1716
1716
|
|
|
1717
1717
|
|
|
1718
1718
|
|
|
1719
|
-
These still deserve provenance review, but they are **not first priority** for
|
|
1719
|
+
These still deserve provenance review, but they are **not first priority** for Indusagi Mono separation.
|
|
1720
1720
|
|
|
1721
1721
|
|
|
1722
1722
|
|
|
@@ -1756,7 +1756,7 @@ These still deserve provenance review, but they are **not first priority** for P
|
|
|
1756
1756
|
|
|
1757
1757
|
## Phase 4 — Final cleanup
|
|
1758
1758
|
|
|
1759
|
-
8. Re-run repo comparison against
|
|
1759
|
+
8. Re-run repo comparison against Indusagi Mono.
|
|
1760
1760
|
|
|
1761
1761
|
9. Confirm there are no exact-match code files left.
|
|
1762
1762
|
|
|
@@ -1774,13 +1774,13 @@ These still deserve provenance review, but they are **not first priority** for P
|
|
|
1774
1774
|
|
|
1775
1775
|
|
|
1776
1776
|
|
|
1777
|
-
You can make a much stronger statement like _"`indusagi-screth` is no longer
|
|
1777
|
+
You can make a much stronger statement like _"`indusagi-screth` is no longer Indusagi Mono-derived"_ only when all of the following are true:
|
|
1778
1778
|
|
|
1779
1779
|
|
|
1780
1780
|
|
|
1781
|
-
- [ ] No exact identical
|
|
1781
|
+
- [ ] No exact identical Indusagi Mono code files remain.
|
|
1782
1782
|
|
|
1783
|
-
- [ ] No copied
|
|
1783
|
+
- [ ] No copied Indusagi Mono vendor assets remain unless separately sourced and attributed.
|
|
1784
1784
|
|
|
1785
1785
|
- [ ] High-risk core files have been independently rewritten.
|
|
1786
1786
|
|
|
@@ -1858,7 +1858,7 @@ These percentages are **approximate line-based estimates**, not legal determinat
|
|
|
1858
1858
|
|
|
1859
1859
|
Method used:
|
|
1860
1860
|
|
|
1861
|
-
- compare the
|
|
1861
|
+
- compare the Indusagi Mono file and the `indusagi-screth` file at the same relative path
|
|
1862
1862
|
|
|
1863
1863
|
- use line counts plus `git diff --no-index --numstat` style added/deleted line counts
|
|
1864
1864
|
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
# Option 3 Plan: Full Provider Adapter Runtime (Claude CLI / Codex CLI / Indusagi CLI)
|
|
2
|
+
|
|
3
|
+
## Objective
|
|
4
|
+
|
|
5
|
+
Implement a **production-grade provider runtime layer** in `indusagi-screth` so CLI-backed providers behave as first-class runtimes, not just `streamSimple` wrappers.
|
|
6
|
+
|
|
7
|
+
Target providers:
|
|
8
|
+
|
|
9
|
+
- `claude-cli`
|
|
10
|
+
- `codex-cli`
|
|
11
|
+
- `indusagi-cli`
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Success Criteria
|
|
16
|
+
|
|
17
|
+
1. Selecting any of the 3 providers routes execution through a dedicated adapter runtime.
|
|
18
|
+
2. Session lifecycle is explicit: start, send turn, interrupt, shutdown, recover.
|
|
19
|
+
3. Provider events are normalized into the existing `AssistantMessageEventStream` path.
|
|
20
|
+
4. Session state persists enough metadata to resume reliably.
|
|
21
|
+
5. Existing API providers keep working unchanged.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Current Constraints in Codebase
|
|
26
|
+
|
|
27
|
+
Relevant current flow:
|
|
28
|
+
|
|
29
|
+
- Provider registration and model list:
|
|
30
|
+
- `app/runtime/model-registry.ts`
|
|
31
|
+
- Stream execution path:
|
|
32
|
+
- `app/runtime/sdk.ts` (`createStreamWithHooks` -> `streamSimple(...)`)
|
|
33
|
+
- Session orchestration and persistence:
|
|
34
|
+
- `app/runtime/agent-session.ts`
|
|
35
|
+
- `app/runtime/session-manager.ts`
|
|
36
|
+
- Extension registration queue:
|
|
37
|
+
- `app/runtime/plugins/loader.ts`
|
|
38
|
+
- `app/runtime/plugins/runner.ts`
|
|
39
|
+
- `app/main.ts`
|
|
40
|
+
- Existing RPC client (useful for `indusagi-cli` adapter):
|
|
41
|
+
- `app/interfaces/service-api/rpc-client.ts`
|
|
42
|
+
|
|
43
|
+
Problem: current runtime assumes model API adapters. CLI runtimes require their own session/event lifecycle.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Target Architecture
|
|
48
|
+
|
|
49
|
+
## 1) New Provider Runtime Module
|
|
50
|
+
|
|
51
|
+
Create a new module tree:
|
|
52
|
+
|
|
53
|
+
- `app/runtime/providers/types.ts`
|
|
54
|
+
- `app/runtime/providers/provider-adapter.ts`
|
|
55
|
+
- `app/runtime/providers/provider-adapter-registry.ts`
|
|
56
|
+
- `app/runtime/providers/provider-service.ts`
|
|
57
|
+
- `app/runtime/providers/adapters/claude-cli-adapter.ts`
|
|
58
|
+
- `app/runtime/providers/adapters/codex-cli-adapter.ts`
|
|
59
|
+
- `app/runtime/providers/adapters/indusagi-cli-adapter.ts`
|
|
60
|
+
|
|
61
|
+
## 2) Core Interfaces
|
|
62
|
+
|
|
63
|
+
### `ProviderAdapter`
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
export interface ProviderAdapter {
|
|
67
|
+
readonly id: string;
|
|
68
|
+
supports(provider: string): boolean;
|
|
69
|
+
|
|
70
|
+
startSession(input: {
|
|
71
|
+
provider: string;
|
|
72
|
+
modelId: string;
|
|
73
|
+
sessionId: string;
|
|
74
|
+
cwd: string;
|
|
75
|
+
}): Promise<ProviderSessionHandle>;
|
|
76
|
+
|
|
77
|
+
streamTurn(input: {
|
|
78
|
+
handle: ProviderSessionHandle;
|
|
79
|
+
model: Model<Api>;
|
|
80
|
+
context: Context;
|
|
81
|
+
options?: SimpleStreamOptions;
|
|
82
|
+
}): AssistantMessageEventStream;
|
|
83
|
+
|
|
84
|
+
interrupt(handle: ProviderSessionHandle): Promise<void>;
|
|
85
|
+
stopSession(handle: ProviderSessionHandle): Promise<void>;
|
|
86
|
+
healthCheck?(): Promise<{ ok: boolean; reason?: string }>;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### `ProviderSessionHandle`
|
|
91
|
+
|
|
92
|
+
Contains adapter-managed runtime identity and metadata:
|
|
93
|
+
|
|
94
|
+
- `adapterId`
|
|
95
|
+
- `provider`
|
|
96
|
+
- `modelId`
|
|
97
|
+
- `runtimeSessionId` (thread/conversation/process id)
|
|
98
|
+
- adapter-specific opaque payload
|
|
99
|
+
|
|
100
|
+
## 3) `ProviderService`
|
|
101
|
+
|
|
102
|
+
Responsibilities:
|
|
103
|
+
|
|
104
|
+
- decide whether a model/provider should use adapter runtime
|
|
105
|
+
- get or create adapter session handle for current agent session
|
|
106
|
+
- stream one turn via adapter
|
|
107
|
+
- interrupt/cleanup active runtime
|
|
108
|
+
- persist runtime metadata for restore
|
|
109
|
+
|
|
110
|
+
Internal state map:
|
|
111
|
+
|
|
112
|
+
- `Map<agentSessionId, ProviderSessionHandle>`
|
|
113
|
+
|
|
114
|
+
## 4) Adapter Registry
|
|
115
|
+
|
|
116
|
+
Responsibilities:
|
|
117
|
+
|
|
118
|
+
- register adapters
|
|
119
|
+
- resolve by provider id
|
|
120
|
+
- expose diagnostics for availability checks
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Integration Plan (File-Level)
|
|
125
|
+
|
|
126
|
+
## Phase 0 — Scaffolding
|
|
127
|
+
|
|
128
|
+
### Add new files
|
|
129
|
+
|
|
130
|
+
- `app/runtime/providers/types.ts`
|
|
131
|
+
- `app/runtime/providers/provider-adapter.ts`
|
|
132
|
+
- `app/runtime/providers/provider-adapter-registry.ts`
|
|
133
|
+
- `app/runtime/providers/provider-service.ts`
|
|
134
|
+
|
|
135
|
+
### Add lightweight tests
|
|
136
|
+
|
|
137
|
+
- `tests/runtime/providers/provider-adapter-registry.test.ts`
|
|
138
|
+
- `tests/runtime/providers/provider-service.test.ts`
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Phase 1 — Runtime Routing in SDK
|
|
143
|
+
|
|
144
|
+
### Modify `app/runtime/sdk.ts`
|
|
145
|
+
|
|
146
|
+
1. Create `ProviderAdapterRegistry` during `createAgentSession()` bootstrap.
|
|
147
|
+
2. Register built-in adapters (`claude-cli`, `codex-cli`, `indusagi-cli`).
|
|
148
|
+
3. Create `ProviderService` and inject references:
|
|
149
|
+
- session id from `SessionManager`
|
|
150
|
+
- cwd
|
|
151
|
+
4. Update `createStreamWithHooks(...)`:
|
|
152
|
+
- before `streamSimple(...)`, call provider service:
|
|
153
|
+
- if adapter exists for `model.provider`, use `providerService.streamTurn(...)`
|
|
154
|
+
- else fallback to existing `streamSimple(...)`
|
|
155
|
+
|
|
156
|
+
Result: model/API providers unaffected; only targeted CLI providers reroute.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Phase 2 — Provider Metadata + Validation
|
|
161
|
+
|
|
162
|
+
### Modify `app/runtime/model-registry.ts`
|
|
163
|
+
|
|
164
|
+
Add provider runtime metadata support in `ProviderConfigInput`:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
runtime?: {
|
|
168
|
+
adapter: "claude-cli" | "codex-cli" | "indusagi-cli" | string;
|
|
169
|
+
authMode?: "apiKey" | "oauth" | "external-cli" | "none";
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Changes:
|
|
174
|
+
|
|
175
|
+
1. Persist runtime config per provider in registry map.
|
|
176
|
+
2. Add `getProviderRuntime(provider: string)` accessor.
|
|
177
|
+
3. Relax validation for `models` when runtime auth is external:
|
|
178
|
+
- if `runtime.authMode` is `external-cli` or `none`, do not require `apiKey/oauth`.
|
|
179
|
+
4. Keep existing validation for normal HTTP API providers.
|
|
180
|
+
|
|
181
|
+
### Modify extension type surface
|
|
182
|
+
|
|
183
|
+
- `app/runtime/plugins/types.ts`
|
|
184
|
+
- extend `ProviderConfig` with same `runtime` field.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Phase 3 — Session Persistence for Adapter State
|
|
189
|
+
|
|
190
|
+
### Modify `app/runtime/session-manager.ts`
|
|
191
|
+
|
|
192
|
+
Use existing custom entry mechanism:
|
|
193
|
+
|
|
194
|
+
- `appendCustomEntry("provider_runtime", data)`
|
|
195
|
+
|
|
196
|
+
Persist after adapter session creation/update:
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"type": "custom",
|
|
201
|
+
"customType": "provider_runtime",
|
|
202
|
+
"data": {
|
|
203
|
+
"provider": "codex-cli",
|
|
204
|
+
"adapterId": "codex-cli",
|
|
205
|
+
"modelId": "gpt-5.4-1m",
|
|
206
|
+
"runtimeSessionId": "...",
|
|
207
|
+
"timestamp": "..."
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
On startup, `ProviderService` should inspect latest relevant custom entry and attempt restore.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Phase 4 — Adapter Implementations
|
|
217
|
+
|
|
218
|
+
## 4.1 `IndusagiCliAdapter` (first, easiest)
|
|
219
|
+
|
|
220
|
+
File:
|
|
221
|
+
|
|
222
|
+
- `app/runtime/providers/adapters/indusagi-cli-adapter.ts`
|
|
223
|
+
|
|
224
|
+
Implementation:
|
|
225
|
+
|
|
226
|
+
- use existing `RpcClient` (`app/interfaces/service-api/rpc-client.ts`)
|
|
227
|
+
- start subprocess in `--mode rpc`
|
|
228
|
+
- set provider/model if needed
|
|
229
|
+
- map incoming RPC events to `AssistantMessageEventStream` events
|
|
230
|
+
- support interrupt/stop cleanly
|
|
231
|
+
|
|
232
|
+
Why first: strong existing API and event stream already available.
|
|
233
|
+
|
|
234
|
+
## 4.2 `CodexCliAdapter`
|
|
235
|
+
|
|
236
|
+
File:
|
|
237
|
+
|
|
238
|
+
- `app/runtime/providers/adapters/codex-cli-adapter.ts`
|
|
239
|
+
|
|
240
|
+
Implementation approach:
|
|
241
|
+
|
|
242
|
+
- mimic t3code `codex app-server` management pattern
|
|
243
|
+
- manage process lifecycle per agent session
|
|
244
|
+
- translate codex events -> normalized assistant stream
|
|
245
|
+
- implement robust retry and “binary missing” errors
|
|
246
|
+
|
|
247
|
+
## 4.3 `ClaudeCliAdapter`
|
|
248
|
+
|
|
249
|
+
File:
|
|
250
|
+
|
|
251
|
+
- `app/runtime/providers/adapters/claude-cli-adapter.ts`
|
|
252
|
+
|
|
253
|
+
Implementation approach:
|
|
254
|
+
|
|
255
|
+
- support preferred Claude CLI invocation/session mode available in your environment
|
|
256
|
+
- parse streaming/stdout events to text deltas
|
|
257
|
+
- add cancellation + process cleanup
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Phase 5 — Agent Session Hooks
|
|
262
|
+
|
|
263
|
+
### Modify `app/runtime/agent-session.ts`
|
|
264
|
+
|
|
265
|
+
Add lifecycle hooks to call provider service:
|
|
266
|
+
|
|
267
|
+
1. On model change to non-adapter provider:
|
|
268
|
+
- stop old adapter session handle (if exists).
|
|
269
|
+
2. On user interrupt/steer path:
|
|
270
|
+
- call `providerService.interrupt(...)` when current provider is adapter-backed.
|
|
271
|
+
3. On session shutdown:
|
|
272
|
+
- `providerService.stopSession(...)`.
|
|
273
|
+
|
|
274
|
+
Goal: no orphan subprocesses and predictable cancellation.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Phase 6 — CLI UX and Login Surface
|
|
279
|
+
|
|
280
|
+
### Modify `app/command-line/login-handler.ts`
|
|
281
|
+
|
|
282
|
+
- include adapter providers only if they actually support login.
|
|
283
|
+
- for `external-cli` auth mode, show clear message:
|
|
284
|
+
- “Authenticate using provider CLI command (e.g., `claude login`, `codex login`)”
|
|
285
|
+
|
|
286
|
+
### Modify `app/command-line/list-models.ts` (optional enhancement)
|
|
287
|
+
|
|
288
|
+
- show runtime-backed providers even without API keys when `authMode=external-cli` and health check passes.
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Phase 7 — Tests
|
|
293
|
+
|
|
294
|
+
Add tests in:
|
|
295
|
+
|
|
296
|
+
- `tests/runtime/providers/*.test.ts`
|
|
297
|
+
- `tests/runtime/model-registry*.test.ts`
|
|
298
|
+
- `tests/runtime/sdk*.test.ts`
|
|
299
|
+
|
|
300
|
+
### Required coverage
|
|
301
|
+
|
|
302
|
+
1. Routing: adapter provider uses `ProviderService`, others use `streamSimple`.
|
|
303
|
+
2. Validation: runtime external providers do not require apiKey/oauth.
|
|
304
|
+
3. Persistence: provider runtime custom entry is written and restored.
|
|
305
|
+
4. Interrupt/shutdown: child process cleanup runs.
|
|
306
|
+
5. Error handling: binary missing, startup failure, malformed stream.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Phase 8 — Rollout Strategy
|
|
311
|
+
|
|
312
|
+
1. Ship behind env flag:
|
|
313
|
+
- `INDUSAGI_ENABLE_PROVIDER_ADAPTERS=1`
|
|
314
|
+
2. Enable only `indusagi-cli` adapter first.
|
|
315
|
+
3. Then enable `codex-cli` and `claude-cli` after integration tests pass.
|
|
316
|
+
4. Remove flag when stable.
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Event Normalization Rules
|
|
321
|
+
|
|
322
|
+
All adapters must normalize to one contract:
|
|
323
|
+
|
|
324
|
+
1. `pushStart(output)`
|
|
325
|
+
2. `pushTextStart(index, output)` once
|
|
326
|
+
3. `pushTextDelta(index, delta, output)` many times
|
|
327
|
+
4. `pushTextEnd(index, finalText, output)` once
|
|
328
|
+
5. `pushDone(stopReason, output)` once
|
|
329
|
+
6. `pushError(...)` on failure path
|
|
330
|
+
|
|
331
|
+
Non-text native events (approvals/tool telemetry) should be mapped to session custom entries first, then surfaced in UI incrementally.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Risks and Mitigations
|
|
336
|
+
|
|
337
|
+
1. **Provider protocol drift** (CLI output formats change)
|
|
338
|
+
- Mitigation: adapter-level parsers with golden tests.
|
|
339
|
+
|
|
340
|
+
2. **Process leaks**
|
|
341
|
+
- Mitigation: strict stop/timeout/SIGKILL policy in provider service.
|
|
342
|
+
|
|
343
|
+
3. **Auth ambiguity for external CLI**
|
|
344
|
+
- Mitigation: explicit `authMode=external-cli` + health checks + clear UX copy.
|
|
345
|
+
|
|
346
|
+
4. **Session mismatch on restore**
|
|
347
|
+
- Mitigation: store adapter/model/provider in custom entry and validate before restore.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Definition of Done
|
|
352
|
+
|
|
353
|
+
- [ ] New provider runtime module exists with registry/service/adapters.
|
|
354
|
+
- [ ] `sdk.ts` routes adapter providers through provider service.
|
|
355
|
+
- [ ] `model-registry.ts` supports runtime metadata and external-cli auth mode.
|
|
356
|
+
- [ ] Adapter session metadata persisted and restorable.
|
|
357
|
+
- [ ] `indusagi-cli` adapter fully working via RPC.
|
|
358
|
+
- [ ] `codex-cli` and `claude-cli` adapters pass smoke tests.
|
|
359
|
+
- [ ] No regressions for existing API providers.
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Recommended Execution Order (Practical)
|
|
364
|
+
|
|
365
|
+
1. Build shared runtime module + routing.
|
|
366
|
+
2. Implement `indusagi-cli` adapter first (uses existing RPC client).
|
|
367
|
+
3. Add persistence + interruption handling.
|
|
368
|
+
4. Implement `codex-cli` adapter.
|
|
369
|
+
5. Implement `claude-cli` adapter.
|
|
370
|
+
6. Harden tests and remove feature flag.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "indusagi-coding-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44",
|
|
4
4
|
"description": "Terminal-first TypeScript coding agent built on the published indusagi package.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"sync:export-vendors": "node tasks/sync-export-vendors.mjs",
|
|
35
35
|
"copy:export-assets": "node tasks/copy-export-assets.mjs",
|
|
36
36
|
"build": "npm run build:observe-local && npm run sync:export-vendors && tsc -p tsconfig.build.json && npm run copy:export-assets && shx chmod +x dist/cli.js",
|
|
37
|
-
"build:observe-local": "node -e \"console.log('Using published indusagi@0.12.
|
|
37
|
+
"build:observe-local": "node -e \"console.log('Using published indusagi@0.12.24')\"",
|
|
38
38
|
"observe:smoke": "npm run build && node dist/dev/observe-smoke.js",
|
|
39
39
|
"observe:smoke:serve": "npm run build && node dist/dev/observe-smoke.js --serve",
|
|
40
40
|
"observe:deep": "npm run build && node dist/dev/observe-deep.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"glob": "^11.0.3",
|
|
54
54
|
"highlight.js": "^11.11.1",
|
|
55
55
|
"i": "^0.3.7",
|
|
56
|
-
"indusagi": "^0.12.
|
|
56
|
+
"indusagi": "^0.12.24",
|
|
57
57
|
"indusagi-coding-agent": "^0.1.42",
|
|
58
58
|
"marked": "^17.0.5",
|
|
59
59
|
"minimatch": "^10.0.3",
|