kiosapi 0.1.2 → 0.1.3

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/help.js CHANGED
@@ -1,5 +1,20 @@
1
+ import { readFileSync } from 'node:fs';
1
2
  import { bold, dim } from './ui.js';
2
- export const VERSION = '0.1.2';
3
+ /**
4
+ * Version — single source of truth is package.json (always shipped in the npm tarball, sitting next
5
+ * to dist/). Read at runtime so a bump only needs editing package.json (e.g. `npm version patch`).
6
+ * dist/help.js → ../package.json resolves to the package root in both dev and the published package.
7
+ */
8
+ function readVersion() {
9
+ try {
10
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
11
+ return pkg.version ?? '0.0.0';
12
+ }
13
+ catch {
14
+ return '0.0.0';
15
+ }
16
+ }
17
+ export const VERSION = readVersion();
3
18
  export function printVersion() {
4
19
  console.log(`kiosapi ${VERSION}`);
5
20
  }
package/dist/session.js CHANGED
@@ -1,10 +1,9 @@
1
- import { createInterface } from 'node:readline/promises';
2
1
  import { newSession, resetSession, runTurn } from './agent/run.js';
3
2
  import { runTeam } from './agent/team.js';
4
3
  import { resolveModel } from './api.js';
5
4
  import { cmdGambar, cmdIsi, cmdLihat, cmdMasuk, cmdPakai, cmdSaldo, cmdVideo, maybeNotifyUpdate, pickModel, warnIfNoTools, } from './commands.js';
6
5
  import { loadConfig } from './config.js';
7
- import { bold, cyan, dim, green, red } from './ui.js';
6
+ import { bold, cyan, dim, green, prompt, red } from './ui.js';
8
7
  const MODES = ['rencana', 'edit', 'buat'];
9
8
  /** The prompt indicator shows the active mode (and ⚡ when auto-approve is on). */
10
9
  function label(s) {
@@ -139,33 +138,30 @@ export async function startSession() {
139
138
  const s = newSession(model, 'buat', false);
140
139
  banner(s);
141
140
  await warnIfNoTools(model);
142
- const rl = createInterface({ input: process.stdin, output: process.stdout });
143
- try {
144
- while (true) {
145
- let line;
146
- try {
147
- line = (await rl.question(label(s))).trim();
148
- }
149
- catch {
150
- break; // stdin closed (Ctrl+D / EOF)
151
- }
152
- if (!line)
153
- continue;
154
- if (line.startsWith('/')) {
155
- if (await runSlash(line, s))
156
- break;
157
- continue;
158
- }
159
- try {
160
- await runTurn(s, line);
161
- }
162
- catch (err) {
163
- console.error(red(err instanceof Error ? err.message : String(err)));
164
- }
141
+ // One readline at a time: each turn uses prompt() (create+close), and slash commands that need
142
+ // their own input (e.g. /model picker, masuk) also use prompt(). A persistent interface here would
143
+ // collide with those → double-echoed input and a stray close that exits the session.
144
+ while (true) {
145
+ let line;
146
+ try {
147
+ line = (await prompt(label(s))).trim();
148
+ }
149
+ catch {
150
+ break; // stdin closed (Ctrl+D / EOF)
151
+ }
152
+ if (!line)
153
+ continue;
154
+ if (line.startsWith('/')) {
155
+ if (await runSlash(line, s))
156
+ break;
157
+ continue;
158
+ }
159
+ try {
160
+ await runTurn(s, line);
161
+ }
162
+ catch (err) {
163
+ console.error(red(err instanceof Error ? err.message : String(err)));
165
164
  }
166
- }
167
- finally {
168
- rl.close();
169
165
  }
170
166
  console.log(green('Sampai jumpa.'));
171
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiosapi",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "CLI Kiosapi.id berbahasa Indonesia — bangun aplikasimu pakai API key Kiosapi (agen + multimodal).",
6
6
  "keywords": [