s-app-scoder-agent 0.9.3 → 0.9.7

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 (112) hide show
  1. package/README.md +615 -638
  2. package/dist/{guardrails.js → agent/guardrails.js} +1 -1
  3. package/dist/agent/interaction.js +70 -0
  4. package/dist/agent/mcp-bridge.js +136 -0
  5. package/dist/agent/prompt-context.js +83 -0
  6. package/dist/agent/run-loop.js +318 -0
  7. package/dist/agent/session-persistence.js +61 -0
  8. package/dist/agent/tool-executor.js +158 -0
  9. package/dist/agent/types.js +88 -0
  10. package/dist/agent/verification.js +99 -0
  11. package/dist/agent.js +239 -1002
  12. package/dist/cli/args.js +230 -0
  13. package/dist/cli/init.js +79 -0
  14. package/dist/cli/main.js +211 -0
  15. package/dist/cli/mcp-command.js +185 -0
  16. package/dist/cli/repl.js +77 -0
  17. package/dist/cli/run-once.js +26 -0
  18. package/dist/{tui/commands.js → commands/definitions.js} +6 -16
  19. package/dist/commands/registry.js +260 -0
  20. package/dist/{config.js → config/config.js} +1 -1
  21. package/dist/{prompt-builder.js → context/prompt-builder.js} +12 -1
  22. package/dist/{prompt.js → context/prompt.js} +111 -9
  23. package/dist/{skills.js → context/skills.js} +41 -2
  24. package/dist/index.js +5 -798
  25. package/dist/io/console-reporter.js +24 -0
  26. package/dist/io/reporter.js +1 -0
  27. package/dist/mcp/connection.js +227 -0
  28. package/dist/mcp/env.js +8 -0
  29. package/dist/{mcp.js → mcp/manager.js} +3 -515
  30. package/dist/mcp/sse.js +28 -0
  31. package/dist/mcp/transport-http.js +140 -0
  32. package/dist/mcp/transport-stdio.js +98 -0
  33. package/dist/mcp/types.js +11 -0
  34. package/dist/media/image.js +149 -0
  35. package/dist/{server.js → server/server.js} +1 -1
  36. package/dist/{cost.js → session/cost.js} +1 -1
  37. package/dist/{session.js → session/session.js} +1 -1
  38. package/dist/{version.js → shared/version.js} +1 -1
  39. package/dist/tools/apply-patch.js +62 -0
  40. package/dist/tools/edit-file.js +29 -0
  41. package/dist/tools/file-edit-common.js +124 -0
  42. package/dist/tools/list-files.js +64 -0
  43. package/dist/tools/path-safety.js +75 -0
  44. package/dist/tools/read-file.js +64 -0
  45. package/dist/tools/registry.js +297 -0
  46. package/dist/tools/run-command.js +192 -0
  47. package/dist/tools/schemas.js +8 -0
  48. package/dist/tools/search.js +237 -0
  49. package/dist/tools/task-tool.js +48 -0
  50. package/dist/tools/types.js +1 -0
  51. package/dist/tools/write-file.js +34 -0
  52. package/dist/tui/app.js +59 -532
  53. package/dist/tui/ask-user-modal.js +2 -1
  54. package/dist/tui/at-complete.js +2 -93
  55. package/dist/tui/charset.js +41 -0
  56. package/dist/tui/chat-views.js +72 -16
  57. package/dist/tui/chrome.js +11 -5
  58. package/dist/tui/hooks/use-command-host.js +26 -0
  59. package/dist/tui/hooks/use-event-queue.js +69 -0
  60. package/dist/tui/hooks/use-keybinds.js +87 -0
  61. package/dist/tui/hooks/use-scroll.js +38 -0
  62. package/dist/tui/hooks/use-session-resume.js +47 -0
  63. package/dist/tui/hooks/use-submit.js +106 -0
  64. package/dist/tui/image.js +2 -149
  65. package/dist/tui/input.js +1 -1
  66. package/dist/tui/markdown/ast.js +5 -0
  67. package/dist/tui/markdown/diagram.js +239 -0
  68. package/dist/tui/markdown/inline-render.js +24 -0
  69. package/dist/tui/markdown/inline.js +93 -0
  70. package/dist/tui/markdown/parse.js +139 -0
  71. package/dist/tui/markdown/render.js +146 -0
  72. package/dist/tui/markdown/table.js +106 -0
  73. package/dist/tui/markdown.js +32 -379
  74. package/dist/tui/permission-modal.js +2 -1
  75. package/dist/tui/selectors.js +157 -0
  76. package/dist/tui/session-picker.js +4 -3
  77. package/dist/tui/sidebar.js +130 -15
  78. package/dist/tui/state.js +47 -118
  79. package/dist/tui/text-width.js +139 -0
  80. package/dist/tui/theme.js +7 -2
  81. package/dist/{build.js → workspace/build.js} +1 -1
  82. package/dist/workspace/file-index.js +93 -0
  83. package/package.json +5 -1
  84. package/dist/tools.js +0 -1223
  85. package/dist/tui/command-registry.js +0 -477
  86. package/dist/tui/review.js +0 -64
  87. package/dist/tui/transcript.js +0 -145
  88. /package/dist/{agents-guide.js → context/agents-guide.js} +0 -0
  89. /package/dist/{agents.js → context/agents.js} +0 -0
  90. /package/dist/{compaction.js → context/compaction.js} +0 -0
  91. /package/dist/{context.js → context/context.js} +0 -0
  92. /package/dist/{memory.js → context/memory.js} +0 -0
  93. /package/dist/{repo-map.js → context/repo-map.js} +0 -0
  94. /package/dist/{ui.js → io/terminal.js} +0 -0
  95. /package/dist/{llm.js → llm/llm.js} +0 -0
  96. /package/dist/{model-catalog.js → llm/model-catalog.js} +0 -0
  97. /package/dist/{provider-anthropic.js → llm/provider-anthropic.js} +0 -0
  98. /package/dist/{provider-registry.js → llm/provider-registry.js} +0 -0
  99. /package/dist/{retry.js → llm/retry.js} +0 -0
  100. /package/dist/{mcp-import.js → mcp/mcp-import.js} +0 -0
  101. /package/dist/{permissions.js → security/permissions.js} +0 -0
  102. /package/dist/{sandbox.js → security/sandbox.js} +0 -0
  103. /package/dist/{shell-scanner.js → security/shell-scanner.js} +0 -0
  104. /package/dist/{logger.js → session/logger.js} +0 -0
  105. /package/dist/{steering.js → session/steering.js} +0 -0
  106. /package/dist/{constants.js → shared/constants.js} +0 -0
  107. /package/dist/{json-schema.js → shared/json-schema.js} +0 -0
  108. /package/dist/{webfetch.js → tools/webfetch.js} +0 -0
  109. /package/dist/{diagnostics.js → workspace/diagnostics.js} +0 -0
  110. /package/dist/{diff.js → workspace/diff.js} +0 -0
  111. /package/dist/{snapshot.js → workspace/snapshot.js} +0 -0
  112. /package/dist/{watch.js → workspace/watch.js} +0 -0
@@ -1,145 +0,0 @@
1
- // ── Export ────────────────────────────────────────────────────────────────────
2
- /** Render a ChatItem to its plain-text representation for export. */
3
- export function itemToText(item) {
4
- switch (item.kind) {
5
- case "user": return `## you\n\n${item.text}`;
6
- case "assistant": return `## agent\n\n${item.text}`;
7
- case "thinking": return `## thinking\n\n${item.text}`;
8
- case "tool": {
9
- const args = Object.entries(item.args).map(([k, v]) => ` ${k}=${JSON.stringify(v)}`).join("\n");
10
- const elapsed = item.durationMs != null ? ` (${item.durationMs}ms)` : "";
11
- const status = item.ok === null ? "running" : item.ok ? "ok" : "FAILED";
12
- return `## tool: ${item.name}${elapsed}\n\n${status}${args ? "\n" + args : ""}\n\n${item.output}`;
13
- }
14
- case "diff":
15
- return `## diff: ${item.path} (+${item.added}/-${item.removed})\n\n${item.text}`;
16
- case "build":
17
- return `## build: ${item.command}\n\n${item.success ? "✓ passed" : "✗ FAILED"}`;
18
- case "todo": {
19
- const rows = item.items.map((t) => `- [${t.status === "completed" ? "x" : t.status === "in_progress" ? ">" : " "}] ${t.content}`);
20
- return `## plan\n\n${rows.join("\n")}`;
21
- }
22
- case "compaction":
23
- return `## compacted (${item.tokensBefore} → ${item.tokensAfter} tokens)${item.manual ? " [manual]" : ""}`;
24
- case "notice":
25
- return `${item.level === "error" ? "✗" : item.level === "warn" ? "⚠" : ""} ${item.text}`;
26
- }
27
- }
28
- /** Format a chat item as Markdown (GitHub-flavored). */
29
- export function itemToMarkdown(item) {
30
- const ts = item.kind === "tool" ? `[${item.step.toString().padStart(2, "0")}]` : "";
31
- switch (item.kind) {
32
- case "user":
33
- return `## you\n\n> ${item.text}`;
34
- case "assistant":
35
- return `## agent\n\n${item.text}`;
36
- case "thinking":
37
- return `> ⊙ ${item.text.split("\n").slice(-4).join(" | ")}`;
38
- case "tool": {
39
- const elapsed = item.durationMs != null ? ` — ${(item.durationMs / 1000).toFixed(1)}s` : "";
40
- const ok = item.ok === null ? "⏳ running" : item.ok ? "✅" : "❌";
41
- const args = Object.keys(item.args).length > 0
42
- ? `\`${item.name}(${Object.entries(item.args).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ")})\``
43
- : `\`${item.name}\``;
44
- return `${ts} ${ok} **${args}**${elapsed}\n\n\`\`\`\n${item.output}\n\`\`\``;
45
- }
46
- case "diff":
47
- return `${ts} ✎ \`${item.path}\` \`+${item.added}/-${item.removed}\`\n\`\`\`diff\n${item.text}\n\`\`\``;
48
- case "build":
49
- return `${item.success ? "✅" : "❌"} **build**: \`${item.command}\``;
50
- case "todo": {
51
- const rows = item.items.map((t) => `- [${t.status === "completed" ? "x" : t.status === "in_progress" ? ">" : " "}] ${t.content}`);
52
- return `## plan\n\n${rows.join("\n")}`;
53
- }
54
- case "compaction":
55
- return `\n---\n*compacted: ${item.tokensBefore} → ${item.tokensAfter} tokens*${item.manual ? " (manual)" : ""}\n---\n`;
56
- case "notice":
57
- return `${item.level === "error" ? "> ❌" : item.level === "warn" ? "> ⚠" : ">"} ${item.text}`;
58
- }
59
- }
60
- /** Export transcript to the requested format. */
61
- export function exportTranscript(items, format = "md") {
62
- if (format === "json") {
63
- return JSON.stringify(items, null, 2);
64
- }
65
- return items.map(itemToMarkdown).join("\n\n");
66
- }
67
- /** Case-insensitive search over transcript items.
68
- * Returns all items whose text representation matches `query`.
69
- * Searches: assistant/thinking text, tool name+output, diff path+text, notice text.
70
- */
71
- export function findInTranscript(items, query) {
72
- if (!query.trim())
73
- return [];
74
- const lc = query.toLowerCase();
75
- const results = [];
76
- for (let i = 0; i < items.length; i++) {
77
- const item = items[i];
78
- const matched = (text) => text.toLowerCase().includes(lc);
79
- let hit = false;
80
- let snippet = "";
81
- switch (item.kind) {
82
- case "assistant":
83
- case "thinking":
84
- if (matched(item.text)) {
85
- hit = true;
86
- snippet = snippetOf(item.text, query);
87
- }
88
- break;
89
- case "tool":
90
- if (matched(item.name) || matched(item.output) || matched(JSON.stringify(item.args))) {
91
- hit = true;
92
- snippet = snippetOf(`${item.name}: ${item.output}`, query);
93
- }
94
- break;
95
- case "diff":
96
- if (matched(item.path) || matched(item.text)) {
97
- hit = true;
98
- snippet = snippetOf(`${item.path} · ${item.text}`, query);
99
- }
100
- break;
101
- case "user":
102
- if (matched(item.text)) {
103
- hit = true;
104
- snippet = snippetOf(item.text, query);
105
- }
106
- break;
107
- case "notice":
108
- if (matched(item.text)) {
109
- hit = true;
110
- snippet = snippetOf(item.text, query);
111
- }
112
- break;
113
- case "build":
114
- if (matched(item.command)) {
115
- hit = true;
116
- snippet = snippetOf(item.command, query);
117
- }
118
- break;
119
- default:
120
- break;
121
- }
122
- if (hit)
123
- results.push({ index: i, kind: item.kind, snippet });
124
- }
125
- return results;
126
- }
127
- /** Return a ~120-char snippet around the first occurrence of `query` in `text`. */
128
- function snippetOf(text, query) {
129
- const pos = text.toLowerCase().indexOf(query.toLowerCase());
130
- if (pos === -1)
131
- return text.slice(0, 120);
132
- const start = Math.max(0, pos - 40);
133
- const end = Math.min(text.length, pos + query.length + 80);
134
- return (start > 0 ? "…" : "") + text.slice(start, end) + (end < text.length ? "…" : "");
135
- }
136
- // ── Copy ─────────────────────────────────────────────────────────────────────
137
- /** Return the copyable text for a chat item (for clipboard). */
138
- export function copyTextForItem(item) {
139
- switch (item.kind) {
140
- case "diff": return item.text;
141
- case "tool": return item.output;
142
- case "assistant": return item.text;
143
- default: return itemToText(item);
144
- }
145
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes