@alashi/cli 0.15.0 → 0.16.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.
package/assets/v1/chat.js CHANGED
@@ -255,9 +255,21 @@
255
255
  try {
256
256
  const res = await fetch(this._hostApi(`/chat/${encodeURIComponent(id)}/history`));
257
257
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
258
- const { messages } = await res.json();
258
+ const { messages, approvals = [] } = await res.json();
259
259
  bubble.remove();
260
- for (const message of messages) this._appendMsg(message.text, message.role);
260
+ // Settled approvals interleave by time; transcript messages carry
261
+ // timestamps, approvals carry requestedAt.
262
+ const items = [
263
+ ...messages.map((m) => ({
264
+ at: m.timestamp ?? '',
265
+ render: () => this._appendMsg(m.text, m.role),
266
+ })),
267
+ ...approvals.map((a) => ({
268
+ at: a.requestedAt ?? '',
269
+ render: () => this._renderSettledApproval(a),
270
+ })),
271
+ ].sort((x, y) => (x.at < y.at ? -1 : x.at > y.at ? 1 : 0));
272
+ for (const item of items) item.render();
261
273
  this._status.textContent = '';
262
274
  } catch (err) {
263
275
  this._showError(bubble, false, `Failed to load history: ${String(err)}`);
@@ -421,12 +433,27 @@
421
433
  act('Approve', { behavior: 'allow' }, true);
422
434
  act('Approve for session', { behavior: 'allow', scope: 'session' });
423
435
  act('Always allow', { behavior: 'allow', scope: 'always' });
436
+ // Grants cover the rule that asked, not the whole tool: say so.
437
+ const always = actions.querySelectorAll('button')[2];
438
+ if (always) {
439
+ always.title = event.reason
440
+ ? `Always allow: ${event.reason}`
441
+ : `Always allow ${event.tool}`;
442
+ }
424
443
  act('Deny', { behavior: 'deny' });
425
444
  card.append(
426
445
  el('div', {
427
446
  className: 'approval-title',
428
447
  textContent: `Approval required: ${event.tool}`,
429
448
  }),
449
+ ...(event.reason
450
+ ? [
451
+ el('div', {
452
+ className: 'approval-reason',
453
+ textContent: `Asked by policy: ${event.reason}`,
454
+ }),
455
+ ]
456
+ : []),
430
457
  ...(preview ? [el('pre', {}, [el('code', { textContent: preview })])] : []),
431
458
  actions,
432
459
  );
@@ -472,6 +499,24 @@
472
499
  );
473
500
  }
474
501
 
502
+ /* A past decision rendered from the approval log (history reload):
503
+ * the same collapsed line a live approval_resolved produces. */
504
+ _renderSettledApproval(record) {
505
+ if (this._approvalCard(record.approvalId)) return;
506
+ const verdict = record.status === 'allowed' ? 'Approved' : 'Denied';
507
+ const why = record.status === 'timeout' ? ' · timeout' : '';
508
+ const card = el('div', { className: 'approval-card resolved' });
509
+ card.dataset.approvalId = record.approvalId;
510
+ card.dataset.tool = record.tool;
511
+ card.append(
512
+ el('div', {
513
+ className: 'approval-title',
514
+ textContent: `${verdict}: ${record.tool}${why}`,
515
+ }),
516
+ );
517
+ this._log.append(card);
518
+ }
519
+
475
520
  async _loadPendingApprovals() {
476
521
  if (!this.conversationId) return;
477
522
  const res = await fetch(
@@ -485,6 +530,8 @@
485
530
  approvalId: approval.approvalId,
486
531
  tool: approval.tool,
487
532
  input: approval.input,
533
+ ...(approval.ruleId ? { ruleId: approval.ruleId } : {}),
534
+ ...(approval.reason ? { reason: approval.reason } : {}),
488
535
  });
489
536
  }
490
537
  }
@@ -686,6 +686,11 @@ alashi-markdown {
686
686
  font-weight: 600;
687
687
  margin-bottom: 0.4rem;
688
688
  }
689
+ .approval-card .approval-reason {
690
+ color: var(--muted);
691
+ font-size: 0.8rem;
692
+ margin: -0.2rem 0 0.4rem;
693
+ }
689
694
  .approval-card pre {
690
695
  max-height: 10rem;
691
696
  overflow: auto;
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as UsageRecorder, E as budgetStatus, N as AuthService, O as setAppBudget, b as loadApp, c as installApp, d as updateApp, f as addRegistry, h as removeRegistry, i as resolveAppConfig, n as createServer, o as exportApp, s as importApp, t as Store, u as removeApp } from "./store-dipRcfKX.mjs";
2
+ import { A as UsageRecorder, E as budgetStatus, N as AuthService, O as setAppBudget, b as loadApp, c as installApp, d as updateApp, f as addRegistry, h as removeRegistry, i as resolveAppConfig, n as createServer, o as exportApp, s as importApp, t as Store, u as removeApp } from "./store-DvLX0Kft.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { APP_NAME_PATTERN, AppSdkError } from "@alashi/apps-sdk";
5
5
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { AIProvider, AgentEvent, AppContext, AppDefinition, AppManifest, AppSdkError, AppUsageSummary, ApprovalDecision, ApprovalScope, ConfigObject, ModelTokenUsage, UsageDay, UsageMonth, UsageQuery, UsageTurn } from "@alashi/apps-sdk";
1
+ import { AIProvider, AgentEvent, AppContext, AppDefinition, AppManifest, AppSdkError, AppUsageSummary, ApprovalDecision, ApprovalScope, CompiledPolicy, ConfigObject, ModelTokenUsage, PolicyDecision, PolicyRule, ToolGate, UsageDay, UsageMonth, UsageQuery, UsageTurn } from "@alashi/apps-sdk";
2
2
  import { Context, Hono, MiddlewareHandler } from "hono";
3
3
  //#region src/sources.d.ts
4
4
  type AppSourceSpec = {
@@ -104,6 +104,10 @@ interface ApprovalRecord {
104
104
  status: "pending" | "allowed" | "denied" | "timeout";
105
105
  decidedAt?: string;
106
106
  scope?: ApprovalScope;
107
+ /** The policy rule that asked, when the tool gateway decided. */
108
+ ruleId?: string;
109
+ /** Human-readable why, e.g. `Bash with command starting with "curl "`. */
110
+ reason?: string;
107
111
  }
108
112
  /** The persisted approval decision log for an app (capped, oldest dropped first). */
109
113
  interface ApprovalLog {
@@ -117,6 +121,29 @@ interface ApprovalLog {
117
121
  interface GrantsState {
118
122
  tools: string[];
119
123
  }
124
+ /**
125
+ * The user's policy overrides for an app (`apps/<name>/policy.json`),
126
+ * evaluated before the manifest's rules. They may tighten anything but only
127
+ * loosen `ask` to `allow` — never past a manifest `deny` (see ToolGateway).
128
+ * "Always allow" decisions are appended here. Legacy `grants.json` tools
129
+ * still count, as tool-wide allow rules.
130
+ */
131
+ interface UserPolicy {
132
+ rules: PolicyRule[];
133
+ }
134
+ /** One gated tool call, as a single line of `apps/<name>/tool-calls.jsonl`. */
135
+ interface ToolCallRecord {
136
+ at: string;
137
+ tool: string;
138
+ toolUseId: string;
139
+ /** JSON of the input, truncated — enough to audit, bounded in size. */
140
+ inputPreview: string;
141
+ decision: PolicyDecision;
142
+ /** Which layer decided: a manifest rule, a user rule, a session grant, or the default. */
143
+ source: "manifest" | "user" | "session" | "default";
144
+ ruleId?: string;
145
+ reason: string;
146
+ }
120
147
  interface Conversation {
121
148
  id: string;
122
149
  /** Provider session backing this conversation; set after the first turn. */
@@ -217,6 +244,8 @@ declare class Store {
217
244
  appJobStatePath(name: string): string;
218
245
  appApprovalLogPath(name: string): string;
219
246
  appGrantsPath(name: string): string;
247
+ appPolicyPath(name: string): string;
248
+ appToolCallsPath(name: string): string;
220
249
  appUsagePath(name: string): string;
221
250
  appTurnsPath(name: string): string;
222
251
  registryCachePath(name: string): string;
@@ -232,6 +261,17 @@ declare class Store {
232
261
  writeApprovalLog(name: string, log: ApprovalLog): Promise<void>;
233
262
  readGrants(name: string): Promise<GrantsState>;
234
263
  writeGrants(name: string, state: GrantsState): Promise<void>;
264
+ readUserPolicy(name: string): Promise<UserPolicy>;
265
+ writeUserPolicy(name: string, policy: UserPolicy): Promise<void>;
266
+ /** Appends one line to the app's tool-call audit ledger. */
267
+ appendToolCall(name: string, record: ToolCallRecord): Promise<void>;
268
+ /**
269
+ * Parseable lines of the tool-call ledger, oldest first. Like the turn
270
+ * ledger, a truncated or hand-mangled line costs only itself.
271
+ */
272
+ readToolCalls(name: string): Promise<ToolCallRecord[]>;
273
+ /** Replaces the tool-call ledger atomically (tmp file + rename), for trimming. */
274
+ writeToolCalls(name: string, records: ToolCallRecord[]): Promise<void>;
235
275
  readJobState(name: string): Promise<JobState>;
236
276
  writeJobState(name: string, state: JobState): Promise<void>;
237
277
  readUsageState(name: string): Promise<UsageState>;
@@ -802,6 +842,49 @@ declare class ApprovalRegistry {
802
842
  flush(): Promise<void>;
803
843
  }
804
844
  //#endregion
845
+ //#region src/tool-gateway.d.ts
846
+ /** What a session's gate needs to know; one per createSession. */
847
+ interface GateSession {
848
+ gate: ToolGate;
849
+ /** Forget this session's grants (call when the session closes). */
850
+ end: () => void;
851
+ }
852
+ /**
853
+ * The host's tool gateway: every tool call any app session makes — chat,
854
+ * cron, app routes; built-in, MCP, subagent — is decided here (see
855
+ * `SessionOptions.toolGate`). Layers, in order:
856
+ *
857
+ * 1. the manifest policy (rules, then `allowedTools`/`askTools` sugar);
858
+ * 2. the user's overrides (`policy.json`, plus legacy `grants.json`) — which
859
+ * may tighten anything but never loosen past a manifest `deny`;
860
+ * 3. session grants ("approve for session"), keyed by the rule that asked;
861
+ *
862
+ * and every decision is appended to the app's `tool-calls.jsonl` audit
863
+ * ledger. `ask` verdicts go on to the provider's interactive approval flow;
864
+ * `applyDecision` turns the user's answer into a session grant or a
865
+ * persistent user rule.
866
+ */
867
+ declare class ToolGateway {
868
+ #private;
869
+ constructor(store: Store);
870
+ /** Builds the gate for one new session of `app`. */
871
+ session(app: string, manifestPolicy: CompiledPolicy): GateSession;
872
+ /** The user override layer as stored: policy.json rules, then legacy grants. */
873
+ userPolicy(app: string): Promise<UserPolicy>;
874
+ /**
875
+ * Applies the scope of a user's answer to a call this gateway sent to
876
+ * `ask`: `session` grants the asking rule for the rest of the session,
877
+ * `always` appends an allow rule with the asking rule's scope to the app's
878
+ * policy.json. Returns false for approvals this gateway never saw (legacy
879
+ * name-level sessions), so the caller can fall back.
880
+ */
881
+ applyDecision(approvalId: string, decision: ApprovalDecision): Promise<boolean>;
882
+ /** The newest audit lines for an app, newest last. */
883
+ recentCalls(app: string, limit?: number): Promise<ToolCallRecord[]>;
884
+ /** Resolves when queued ledger and policy writes have landed (tests). */
885
+ flush(): Promise<void>;
886
+ }
887
+ //#endregion
805
888
  //#region src/runtime.d.ts
806
889
  /**
807
890
  * Builds the AppContext for an installed app: merges the config layers
@@ -820,7 +903,7 @@ declare class ApprovalRegistry {
820
903
  * `ctx.usage` answers "nothing recorded" — the member is required by the
821
904
  * contract, so it is always present.
822
905
  */
823
- declare function buildAppContext(store: Store, manifest: AppManifest, provider: AIProvider, usage?: UsageRecorder, approvals?: ApprovalRegistry): Promise<AppContext>;
906
+ declare function buildAppContext(store: Store, manifest: AppManifest, provider: AIProvider, usage?: UsageRecorder, approvals?: ApprovalRegistry, gateway?: ToolGateway): Promise<AppContext>;
824
907
  //#endregion
825
908
  //#region src/scheduler.d.ts
826
909
  interface SchedulableApp {
@@ -940,8 +1023,11 @@ interface ServerOptions {
940
1023
  * optionally adopting an existing provider session (e.g. an
941
1024
  * app-run investigation) so chat continues where it left off
942
1025
  * GET /api/apps/:name/chat/:conversationId/history past turns from the provider transcript
1026
+ * plus the conversation's settled approval records
943
1027
  * GET /api/apps/:name/jobs manifest-declared jobs with schedule/status
944
1028
  * POST /api/apps/:name/jobs/:job/run trigger a job now (409 while already running)
1029
+ * GET /api/apps/:name/policy effective tool policy: user overrides + manifest rules
1030
+ * GET /api/apps/:name/tool-calls?limit= newest gated tool calls (audit ledger)
945
1031
  * GET /api/apps/:name/manifest read-only app definition: instructions, agents,
946
1032
  * skills (with dir contents), allowed tools,
947
1033
  * MCP servers (with configured state), jobs, model
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/sources.ts","../src/store.ts","../src/auth.ts","../src/usage.ts","../src/budget.ts","../src/compat.ts","../src/installer.ts","../src/loader.ts","../src/portability.ts","../src/registry.ts","../src/approvals.ts","../src/runtime.ts","../src/scheduler.ts","../src/server.ts"],"mappings":";;;KAQY;EACN;EAAa;EAAa;;EAC1B;EAAe;;;KAGT,YAAY;EAAkB;EAAkB;;iBAE5C,eAAe,cAAc;;iBAwBvB,YAAY,MAAM,eAAe,kBAAkB;;iBAanD,aAAa,MAAM,eAAe,kBAAkB;;;UCrCzD;EACf;EACA;;;UAIe;;;;;EAKf;;;;;;;;;;;;;;K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IACE,iBACA,iBACA,UAAS,oBACR,QAAQ;;EAmCX,OAAa,kBAAkB,QAAQ;UA4B/B;;;;UClDO;;EAEf,KAAK;;EAEL,WAAW;;EAEX,MAAM;;EAEN,SAAS;;UAGM;;EAEf,OAAO;;;;;;EAMP,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoEL,aACd,OAAO,OACP,UAAU,YACV,UAAS,gBACR"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/sources.ts","../src/store.ts","../src/auth.ts","../src/usage.ts","../src/budget.ts","../src/compat.ts","../src/installer.ts","../src/loader.ts","../src/portability.ts","../src/registry.ts","../src/approvals.ts","../src/tool-gateway.ts","../src/runtime.ts","../src/scheduler.ts","../src/server.ts"],"mappings":";;;KAQY;EACN;EAAa;EAAa;;EAC1B;EAAe;;;KAGT,YAAY;EAAkB;EAAkB;;iBAE5C,eAAe,cAAc;;iBAwBvB,YAAY,MAAM,eAAe,kBAAkB;;iBAanD,aAAa,MAAM,eAAe,kBAAkB;;;UCnCzD;EACf;EACA;;;UAIe;;;;;EAKf;;;;;;;;;;;;;;KAeU;;UAGK;EACf,OAAO;;;;;;EAMP;;;;;;;EAOA;;UAGe;EACf,YAAY;EACZ;;EAEA;;EAEA,OAAO;;EAEP,OAAO,eAAe;;;;;;;;;EAStB,UAAU,eAAe;;;;;EAKzB;;;;;;;;UASe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;;EAER;;EAEA;;;UAIe;EACf,WAAW;;;;;;;UAQI;EACf;;;;;;;;;UAUe;EACf,OAAO;;;UAIQ;EACf;EACA;EACA;;EAEA;EACA,UAAU;;EAEV;EACA;EACA;;UAGe;EACf;;EAEA;EACA;EACA;;;UAIe;EACf,eAAe;;UAGA;EACf;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf,SAAS;EACT,MAAM;;;;;;;;UAwBS;EACf,M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0B,iBAAiB,QAAQ;EAGrD,SAAe;EAuCf;;MAOI;;;;;EAQJ,IACE,iBACA,iBACA,UAAS,oBACR,QAAQ;;EAmCX,OAAa,kBAAkB,QAAQ;UA4B/B;;;;UC9CO;;EAEf,KAAK;;EAEL,WAAW;;EAEX,MAAM;;EAEN,SAAS;;UAGM;;EAEf,OAAO;;;;;;EAMP,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuEL,aACd,OAAO,OACP,UAAU,YACV,UAAS,gBACR"}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { A as UsageRecorder, C as BudgetExceededError, D as budgetStatusFor, E as budgetStatus, F as createAuthMiddleware, I as isConsoleRequest, L as registerAuthRoutes, M as utcDay, N as AuthService, O as setAppBudget, P as SESSION_COOKIE, R as requiredLevel, S as BUDGET_EXCEEDED_CODE, T as assertWithinBudget, _ as fetchSource, a as EXPORT_FORMAT_VERSION, b as loadApp, c as installApp, d as updateApp, f as addRegistry, g as resolveApp, h as removeRegistry, j as formatUsd, k as USAGE_RETENTION_DAYS, l as installDependencies, m as refreshRegistry, n as createServer, o as exportApp, p as readCachedIndex, r as buildAppContext, s as importApp, t as Store, u as removeApp, v as parseSourceArg, w as appBudget, x as checkSdkCompatibility, y as updateSource } from "./store-dipRcfKX.mjs";
1
+ import { A as UsageRecorder, C as BudgetExceededError, D as budgetStatusFor, E as budgetStatus, F as createAuthMiddleware, I as isConsoleRequest, L as registerAuthRoutes, M as utcDay, N as AuthService, O as setAppBudget, P as SESSION_COOKIE, R as requiredLevel, S as BUDGET_EXCEEDED_CODE, T as assertWithinBudget, _ as fetchSource, a as EXPORT_FORMAT_VERSION, b as loadApp, c as installApp, d as updateApp, f as addRegistry, g as resolveApp, h as removeRegistry, j as formatUsd, k as USAGE_RETENTION_DAYS, l as installDependencies, m as refreshRegistry, n as createServer, o as exportApp, p as readCachedIndex, r as buildAppContext, s as importApp, t as Store, u as removeApp, v as parseSourceArg, w as appBudget, x as checkSdkCompatibility, y as updateSource } from "./store-DvLX0Kft.mjs";
2
2
  export { AuthService, BUDGET_EXCEEDED_CODE, BudgetExceededError, EXPORT_FORMAT_VERSION, SESSION_COOKIE, Store, USAGE_RETENTION_DAYS, UsageRecorder, addRegistry, appBudget, assertWithinBudget, budgetStatus, budgetStatusFor, buildAppContext, checkSdkCompatibility, createAuthMiddleware, createServer, exportApp, fetchSource, formatUsd, importApp, installApp, installDependencies, isConsoleRequest, loadApp, parseSourceArg, readCachedIndex, refreshRegistry, registerAuthRoutes, removeApp, removeRegistry, requiredLevel, resolveApp, setAppBudget, updateApp, updateSource, utcDay };