@ywldan/kiro 0.1.0 → 0.2.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.
Files changed (42) hide show
  1. package/README.md +50 -5
  2. package/dist/agent/loop.js +3 -0
  3. package/dist/agent/loop.js.map +1 -1
  4. package/dist/config.js +30 -0
  5. package/dist/config.js.map +1 -1
  6. package/dist/headless.js +219 -0
  7. package/dist/headless.js.map +1 -0
  8. package/dist/index.js +56 -7
  9. package/dist/index.js.map +1 -1
  10. package/dist/model/wizard.js +3 -0
  11. package/dist/model/wizard.js.map +1 -1
  12. package/dist/providers/openai.js +101 -4
  13. package/dist/providers/openai.js.map +1 -1
  14. package/dist/providers/types.js.map +1 -1
  15. package/dist/tools/checkpoint.js +158 -0
  16. package/dist/tools/checkpoint.js.map +1 -0
  17. package/dist/tools/fs.js +4 -0
  18. package/dist/tools/fs.js.map +1 -1
  19. package/dist/tools/patch.js +2 -0
  20. package/dist/tools/patch.js.map +1 -1
  21. package/dist/ui/App.js +191 -17
  22. package/dist/ui/App.js.map +1 -1
  23. package/dist/ui/Input.js +50 -7
  24. package/dist/ui/Input.js.map +1 -1
  25. package/dist/ui/MessageList.js +27 -2
  26. package/dist/ui/MessageList.js.map +1 -1
  27. package/dist/ui/ModelPicker.js +100 -0
  28. package/dist/ui/ModelPicker.js.map +1 -0
  29. package/dist/ui/StatusBar.js +8 -5
  30. package/dist/ui/StatusBar.js.map +1 -1
  31. package/dist/ui/commands.js +1 -0
  32. package/dist/ui/commands.js.map +1 -1
  33. package/dist/ui/model-picker.js +59 -0
  34. package/dist/ui/model-picker.js.map +1 -0
  35. package/dist/ui/profile-list.js +11 -6
  36. package/dist/ui/profile-list.js.map +1 -1
  37. package/dist/ui/prompt-history.js +69 -0
  38. package/dist/ui/prompt-history.js.map +1 -0
  39. package/dist/ui/types.js +2 -0
  40. package/dist/ui/types.js.map +1 -1
  41. package/dist/version.js +1 -1
  42. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
2
+ import { createHash, randomBytes } from 'node:crypto';
3
+ import { homedir } from 'node:os';
4
+ import path from 'node:path';
5
+ import { redactSecrets } from '../secrets.js';
6
+ /**
7
+ * Recallable prompt history, one file per working directory, stored under
8
+ * ~/.kiro/history/<cwd-hash>.json. Plaintext by design, like shell history:
9
+ * it holds what the user typed (with registered key values redacted), never
10
+ * tool output.
11
+ */
12
+ const MAX_HISTORY = 200;
13
+ const historyCache = new Map();
14
+ function historyRoot() {
15
+ return process.env.KIRO_HISTORY_DIR || path.join(homedir(), '.kiro', 'history');
16
+ }
17
+ function historyFile(cwd) {
18
+ const key = createHash('sha256').update(path.resolve(cwd)).digest('hex').slice(0, 16);
19
+ return path.join(historyRoot(), `${key}.json`);
20
+ }
21
+ export async function loadPromptHistory(cwd) {
22
+ const file = historyFile(cwd);
23
+ const cached = historyCache.get(file);
24
+ if (cached)
25
+ return [...cached];
26
+ let entries = [];
27
+ try {
28
+ const parsed = JSON.parse(await readFile(file, 'utf8'));
29
+ if (Array.isArray(parsed)) {
30
+ entries = parsed.filter((entry) => typeof entry === 'string');
31
+ }
32
+ }
33
+ catch {
34
+ // No history yet.
35
+ }
36
+ historyCache.set(file, entries);
37
+ return [...entries];
38
+ }
39
+ /** Applies the same dedupe/cap rules the on-disk store uses. */
40
+ export function rememberPrompt(entries, prompt) {
41
+ const text = redactSecrets(prompt).trim();
42
+ if (!text)
43
+ return [...entries];
44
+ const next = [...entries];
45
+ if (next[next.length - 1] === text)
46
+ return next;
47
+ const index = next.indexOf(text);
48
+ if (index !== -1)
49
+ next.splice(index, 1); // most recent use wins
50
+ next.push(text);
51
+ return next.slice(-MAX_HISTORY);
52
+ }
53
+ /** Records a submitted prompt and returns the updated list for the live UI. */
54
+ export async function recordPrompt(cwd, prompt) {
55
+ const file = historyFile(cwd);
56
+ const entries = rememberPrompt(historyCache.get(file) ?? [], prompt);
57
+ historyCache.set(file, entries);
58
+ try {
59
+ await mkdir(historyRoot(), { recursive: true, mode: 0o700 });
60
+ const temp = `${file}.${randomBytes(4).toString('hex')}.tmp`;
61
+ await writeFile(temp, `${JSON.stringify(entries)}\n`, { encoding: 'utf8', mode: 0o600 });
62
+ await rename(temp, file);
63
+ }
64
+ catch {
65
+ // History is best effort; losing a write never blocks the session.
66
+ }
67
+ return [...entries];
68
+ }
69
+ //# sourceMappingURL=prompt-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-history.js","sourceRoot":"","sources":["../../src/ui/prompt-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;GAKG;AAEH,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,YAAY,GAAG,IAAI,GAAG,EAAoB,CAAC;AAEjD,SAAS,WAAW;IAClB,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAClF,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACtF,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,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CAAC,CAAC,CAAC,CAAC,uBAAuB;IAChE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC;AAClC,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,MAAc;IAC5D,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,OAAO,GAAG,cAAc,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IACrE,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAC7D,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACzF,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,mEAAmE;IACrE,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AACtB,CAAC"}
package/dist/ui/types.js CHANGED
@@ -1,3 +1,5 @@
1
1
  /** Full tool output retained for the Ctrl+O expansion; capped to keep memory bounded. */
2
2
  export const MAX_EXPANDED_TOOL_CHARS = 20_000;
3
+ /** Bound the live reasoning buffer so a chatty reasoning model cannot flood the layout. */
4
+ export const MAX_REASONING_CHARS = 8_000;
3
5
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ui/types.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ui/types.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AA8B9C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC"}
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.0';
1
+ export const VERSION = '0.2.0';
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ywldan/kiro",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A small terminal coding agent with your own OpenAI-compatible endpoint",
5
5
  "keywords": [
6
6
  "ai",