@leanandmean/coding-agent 0.74.1-scramjet.34 → 0.74.1-scramjet.39

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  4. package/dist/core/agent-session-runtime.js +1 -0
  5. package/dist/core/agent-session-runtime.js.map +1 -1
  6. package/dist/core/agent-session-services.d.ts +1 -0
  7. package/dist/core/agent-session-services.d.ts.map +1 -1
  8. package/dist/core/agent-session-services.js +2 -0
  9. package/dist/core/agent-session-services.js.map +1 -1
  10. package/dist/core/agent-session.d.ts +15 -0
  11. package/dist/core/agent-session.d.ts.map +1 -1
  12. package/dist/core/agent-session.js +90 -0
  13. package/dist/core/agent-session.js.map +1 -1
  14. package/dist/core/extensions/index.d.ts +1 -1
  15. package/dist/core/extensions/index.d.ts.map +1 -1
  16. package/dist/core/extensions/index.js.map +1 -1
  17. package/dist/core/extensions/runner.d.ts +6 -5
  18. package/dist/core/extensions/runner.d.ts.map +1 -1
  19. package/dist/core/extensions/runner.js +48 -1
  20. package/dist/core/extensions/runner.js.map +1 -1
  21. package/dist/core/extensions/types.d.ts +16 -1
  22. package/dist/core/extensions/types.d.ts.map +1 -1
  23. package/dist/core/extensions/types.js.map +1 -1
  24. package/dist/core/output-throughput-history.d.ts +25 -0
  25. package/dist/core/output-throughput-history.d.ts.map +1 -0
  26. package/dist/core/output-throughput-history.js +240 -0
  27. package/dist/core/output-throughput-history.js.map +1 -0
  28. package/dist/core/output-throughput.d.ts +43 -0
  29. package/dist/core/output-throughput.d.ts.map +1 -0
  30. package/dist/core/output-throughput.js +161 -0
  31. package/dist/core/output-throughput.js.map +1 -0
  32. package/dist/core/sdk.d.ts +2 -0
  33. package/dist/core/sdk.d.ts.map +1 -1
  34. package/dist/core/sdk.js +11 -2
  35. package/dist/core/sdk.js.map +1 -1
  36. package/dist/core/skills.d.ts.map +1 -1
  37. package/dist/core/skills.js +6 -2
  38. package/dist/core/skills.js.map +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  43. package/dist/modes/interactive/components/footer.js +6 -2
  44. package/dist/modes/interactive/components/footer.js.map +1 -1
  45. package/dist/modes/interactive/components/model-selector.d.ts +3 -1
  46. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  47. package/dist/modes/interactive/components/model-selector.js +9 -3
  48. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  49. package/dist/modes/interactive/components/scoped-models-selector.d.ts +3 -1
  50. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  51. package/dist/modes/interactive/components/scoped-models-selector.js +8 -2
  52. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  53. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  54. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  55. package/dist/modes/interactive/interactive-mode.js +45 -7
  56. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  57. package/docs/extensions.md +24 -4
  58. package/docs/models.md +2 -0
  59. package/docs/session-format.md +2 -1
  60. package/docs/skills.md +2 -2
  61. package/docs/usage.md +3 -1
  62. package/package.json +8 -4
@@ -288,8 +288,12 @@ user sends prompt ────────────────────
288
288
  │ ┌─── turn (repeats while LLM calls tools) ───┐ │
289
289
  │ │ │ │
290
290
  │ ├─► turn_start │ │
291
+ │ ├─► routing refresh │ │
291
292
  │ ├─► context (can modify messages) │ │
293
+ │ ├─► before_provider_call (can replace request-local system prompt)
294
+ │ ├─► provider serialization │ │
292
295
  │ ├─► before_provider_request (can inspect or replace payload)
296
+ │ ├─► transport │ │
293
297
  │ ├─► after_provider_response (status + headers, before stream consume)
294
298
  │ │ │ │
295
299
  │ │ LLM responds, may call tools: │ │
@@ -630,14 +634,29 @@ pi.on("context", async (event, ctx) => {
630
634
  });
631
635
  ```
632
636
 
637
+ #### before_provider_call
638
+
639
+ Fired after request routing and message-context transformation, immediately before provider serialization. `event.model` is an immutable, handler-isolated snapshot of the exact model routed for this call, and `event.systemPrompt` is its request-local provider-neutral prompt (`string` or `SystemPromptSection[]`). Return `{ systemPrompt }` to replace only this call's prompt. Replacements chain in extension load order and never accumulate in session state.
640
+
641
+ ```typescript
642
+ pi.on("before_provider_call", (event) => {
643
+ return {
644
+ systemPrompt: typeof event.systemPrompt === "string"
645
+ ? `${event.systemPrompt}\n\nRequest routed to ${event.model.provider}/${event.model.id}`
646
+ : [...event.systemPrompt, { id: "routed-model", text: `\n\nRequest routed to ${event.model.provider}/${event.model.id}` }],
647
+ };
648
+ });
649
+ ```
650
+
633
651
  #### before_provider_request
634
652
 
635
- Fired after the provider-specific payload is built, right before the request is sent. Handlers run in extension load order. Returning `undefined` keeps the payload unchanged. Returning any other value replaces the payload for later handlers and for the actual request.
653
+ Fired after the provider-specific payload is built, right before transport. `event.model` is a fresh immutable snapshot of the same exact routed model exposed by `before_provider_call`; mutating one handler's snapshot cannot affect later handlers or transport routing. Handlers run in extension load order. Returning `undefined` keeps the payload unchanged. Returning any other value replaces the payload for later handlers and for the actual request.
636
654
 
637
- This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports Scramjet's system prompt string rather than the final serialized provider payload.
655
+ This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports Scramjet's stored system prompt string rather than request-local `before_provider_call` changes or the final serialized provider payload.
638
656
 
639
657
  ```typescript
640
- pi.on("before_provider_request", (event, ctx) => {
658
+ pi.on("before_provider_request", (event) => {
659
+ console.log(`${event.model.provider}/${event.model.id}`);
641
660
  console.log(JSON.stringify(event.payload, null, 2));
642
661
 
643
662
  // Optional: replace payload
@@ -645,7 +664,7 @@ pi.on("before_provider_request", (event, ctx) => {
645
664
  });
646
665
  ```
647
666
 
648
- This is mainly useful for debugging provider serialization and cache behavior.
667
+ The complete request order is routing refresh → `context` transformation → `before_provider_call` → provider serialization → `before_provider_request` → transport. This is mainly useful for request-local prompt preparation and debugging provider serialization or cache behavior.
649
668
 
650
669
  #### after_provider_response
651
670
 
@@ -995,6 +1014,7 @@ Returns Scramjet's current system prompt string.
995
1014
 
996
1015
  - During `before_agent_start`, this reflects chained system-prompt changes made so far for the current turn.
997
1016
  - It does not include later `context` message mutations.
1017
+ - It does not include request-local `before_provider_call` prompt replacements.
998
1018
  - It does not include `before_provider_request` payload rewrites.
999
1019
  - If later-loaded extensions run after yours, they can still change what is ultimately sent.
1000
1020
 
package/docs/models.md CHANGED
@@ -91,6 +91,8 @@ Override defaults when you need specific values:
91
91
 
92
92
  The file reloads each time you open `/model`. Edit during session; no restart needed.
93
93
 
94
+ When valid history exists, `/model` and `/scoped-models` append a recent median output-rate estimate to the requested provider/model row. The estimate uses normalized final output usage over first-to-last generated output, excluding time to first token and trailing completion latency; no placeholder is shown for models without history.
95
+
94
96
  ## Google AI Studio Example
95
97
 
96
98
  Use `google-generative-ai` with a `baseUrl` to add models from Google AI Studio, including custom Gemma 4 entries:
@@ -81,6 +81,7 @@ interface UserMessage {
81
81
  interface AssistantMessage {
82
82
  role: "assistant";
83
83
  content: (TextContent | ThinkingContent | ToolCall)[];
84
+ origin?: "provider" | "harness"; // Explicit for new messages; absent in legacy sessions
84
85
  api: string;
85
86
  provider: string;
86
87
  model: string;
@@ -203,7 +204,7 @@ A message in the conversation. The `message` field contains an `AgentMessage`.
203
204
 
204
205
  ```json
205
206
  {"type":"message","id":"a1b2c3d4","parentId":"prev1234","timestamp":"2024-12-03T14:00:01.000Z","message":{"role":"user","content":"Hello"}}
206
- {"type":"message","id":"b2c3d4e5","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:00:02.000Z","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}],"provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop"}}
207
+ {"type":"message","id":"b2c3d4e5","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:00:02.000Z","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}],"origin":"provider","provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop"}}
207
208
  {"type":"message","id":"c3d4e5f6","parentId":"b2c3d4e5","timestamp":"2024-12-03T14:00:03.000Z","message":{"role":"toolResult","toolCallId":"call_123","toolName":"bash","content":[{"type":"text","text":"output"}],"isError":false}}
208
209
  ```
209
210
 
package/docs/skills.md CHANGED
@@ -141,7 +141,7 @@ Per the [Agent Skills specification](https://agentskills.io/specification#frontm
141
141
  | Field | Required | Description |
142
142
  |-------|----------|-------------|
143
143
  | `name` | Yes | Max 64 chars. Lowercase a-z, 0-9, hyphens. Unlike the standard, Scramjet does not require this to match the parent directory because that standard requirement is suboptimal for shared skill directories. |
144
- | `description` | Yes | Max 1024 chars. What the skill does and when to use it. |
144
+ | `description` | Yes | The Agent Skills specification maximum is 1024 chars. Scramjet warns above this limit but retains the complete description in the generated model-visible skills list unless model invocation is disabled. |
145
145
  | `license` | No | License name or reference to bundled file. |
146
146
  | `compatibility` | No | Max 500 chars. Environment requirements. |
147
147
  | `metadata` | No | Arbitrary key-value mapping. |
@@ -179,7 +179,7 @@ Scramjet validates skills against the Agent Skills standard. Most issues produce
179
179
 
180
180
  - Name exceeds 64 characters or contains invalid characters
181
181
  - Name starts/ends with hyphen or has consecutive hyphens
182
- - Description exceeds 1024 characters
182
+ - Description exceeds the Agent Skills specification maximum of 1024 characters. This warning is advisory: Scramjet retains the complete description in the generated model-visible skills list unless `disable-model-invocation` is `true`.
183
183
 
184
184
  Unknown frontmatter fields are ignored.
185
185
 
package/docs/usage.md CHANGED
@@ -11,7 +11,9 @@ The interface has four main areas:
11
11
  - **Startup header** - shortcuts, loaded context files, prompt templates, skills, and extensions
12
12
  - **Messages** - user messages, assistant responses, tool calls, tool results, notifications, errors, and extension UI
13
13
  - **Editor** - where you type; border color indicates the current thinking level
14
- - **Footer** - working directory, session name, token/cache usage, cost, context usage, and current model
14
+ - **Footer** - working directory, session name, token/cache usage, cost, context usage, current model, and output speed when valid data exists
15
+
16
+ The footer shows the current model's recent median output-rate estimate beside a nonzero session output total when valid history exists. The `/model` and `/scoped-models` selectors annotate every model row that has valid history. Completed and historical estimates use normalized final output usage over the interval from the first to last generated output; they exclude time to first token and trailing completion latency.
15
17
 
16
18
  The editor can be replaced temporarily by built-in UI such as `/settings` or by custom extension UI.
17
19
 
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@leanandmean/coding-agent",
3
- "version": "0.74.1-scramjet.34",
3
+ "version": "0.74.1-scramjet.39",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
8
8
  "license": "Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/LeanAndMean/scramjet.git"
12
+ },
9
13
  "type": "module",
10
14
  "piConfig": {
11
15
  "name": "scramjet",
@@ -33,9 +37,9 @@
33
37
  "test": "vitest --run --passWithNoTests"
34
38
  },
35
39
  "dependencies": {
36
- "@leanandmean/agent": "0.74.1-scramjet.15",
37
- "@leanandmean/ai": "0.74.1-scramjet.11",
38
- "@leanandmean/tui": "0.74.1-scramjet.10",
40
+ "@leanandmean/agent": "0.74.1-scramjet.18",
41
+ "@leanandmean/ai": "0.74.1-scramjet.14",
42
+ "@leanandmean/tui": "0.74.1-scramjet.11",
39
43
  "@silvia-odwyer/photon-node": "^0.3.4",
40
44
  "chalk": "^5.5.0",
41
45
  "dictionary-en": "^4.0.0",