@alashi/cli 0.14.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/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { AIProvider, AppContext, AppDefinition, AppManifest, AppSdkError, ConfigObject, ModelTokenUsage } 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 = {
@@ -81,6 +81,68 @@ interface GlobalConfig {
81
81
  * A cap is enforcement, so it lives where only the host can set it.
82
82
  */
83
83
  budgets?: Record<string, AppBudget>;
84
+ /**
85
+ * Seconds before a pending tool approval is auto-denied; default 300.
86
+ * Host policy like `budgets`: an app can never extend its own window.
87
+ */
88
+ approvalTimeoutSeconds?: number;
89
+ }
90
+ /**
91
+ * One tool-approval request, as surfaced to the user and logged in
92
+ * `apps/<name>/approvals.json`. `conversationId` is present for chat-born
93
+ * approvals; a cron/app-route approval has none and only shows up in the
94
+ * host-wide pending list.
95
+ */
96
+ interface ApprovalRecord {
97
+ approvalId: string;
98
+ app: string;
99
+ conversationId?: string;
100
+ tool: string;
101
+ input: unknown;
102
+ requestedAt: string;
103
+ expiresAt: string;
104
+ status: "pending" | "allowed" | "denied" | "timeout";
105
+ decidedAt?: string;
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;
111
+ }
112
+ /** The persisted approval decision log for an app (capped, oldest dropped first). */
113
+ interface ApprovalLog {
114
+ approvals: ApprovalRecord[];
115
+ }
116
+ /**
117
+ * Always-allow grants for an app's ask-tier tools (`apps/<name>/grants.json`).
118
+ * OS bookkeeping like jobs.json — deliberately not a config.json key, which
119
+ * would restart the app (dropping its warm session) on every grant.
120
+ */
121
+ interface GrantsState {
122
+ tools: string[];
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;
84
146
  }
85
147
  interface Conversation {
86
148
  id: string;
@@ -106,33 +168,6 @@ interface JobState {
106
168
  lastRun: Record<string, string>;
107
169
  runs: JobRun[];
108
170
  }
109
- /** Tokens and cost one model consumed within a usage bucket (a day or a month). */
110
- interface ModelUsageTotals {
111
- inputTokens: number;
112
- outputTokens: number;
113
- cacheReadInputTokens: number;
114
- cacheCreationInputTokens: number;
115
- costUsd: number;
116
- }
117
- /** One UTC day of AI spend for an app. */
118
- interface UsageDay {
119
- /** UTC calendar day, `YYYY-MM-DD`. */
120
- date: string;
121
- /** Sum of the `costUsd` the provider reported for that day's turns. */
122
- costUsd: number;
123
- /** Turns that reported cost or token usage (turns without either are not counted). */
124
- turns: number;
125
- /** Per-model token/cost totals, keyed by the engine's model id. Absent for days recorded before token metering. */
126
- models?: Record<string, ModelUsageTotals>;
127
- }
128
- /** One UTC calendar month of AI spend; months are never pruned. */
129
- interface UsageMonth {
130
- /** UTC calendar month, `YYYY-MM`. */
131
- month: string;
132
- costUsd: number;
133
- turns: number;
134
- models?: Record<string, ModelUsageTotals>;
135
- }
136
171
  /**
137
172
  * Host-side AI spend for an app: daily series (oldest first, trimmed to the
138
173
  * retention window) plus monthly rollups that survive daily pruning so
@@ -143,6 +178,19 @@ interface UsageState {
143
178
  days: UsageDay[];
144
179
  months?: UsageMonth[];
145
180
  }
181
+ /**
182
+ * One metered AI turn, as stored on a single line of `apps/<name>/turns.jsonl`
183
+ * — the SDK's `UsageTurn`, which is exactly what `ctx.usage.turns()` returns.
184
+ * Kept under a host name because the ledger, not the SDK, is where these lines
185
+ * live.
186
+ *
187
+ * The append-only ledger `usage.json` is a fold over: it carries enough to
188
+ * reproduce every day/month bucket (cost *and* per-model tokens) plus the
189
+ * session attribution the aggregates throw away. `sessionId`, `model`, and
190
+ * `modelUsage` are omitted when the engine did not report them; `costUsd` is
191
+ * always present and is `0` for a turn that reported tokens but no cost.
192
+ */
193
+ type TurnRecord = UsageTurn;
146
194
  /** A long-lived bearer credential; only the sha256 of the secret is stored. */
147
195
  interface AuthTokenRecord {
148
196
  id: string;
@@ -194,7 +242,12 @@ declare class Store {
194
242
  appRecordPath(name: string): string;
195
243
  appChatStatePath(name: string): string;
196
244
  appJobStatePath(name: string): string;
245
+ appApprovalLogPath(name: string): string;
246
+ appGrantsPath(name: string): string;
247
+ appPolicyPath(name: string): string;
248
+ appToolCallsPath(name: string): string;
197
249
  appUsagePath(name: string): string;
250
+ appTurnsPath(name: string): string;
198
251
  registryCachePath(name: string): string;
199
252
  readGlobalConfig(): Promise<GlobalConfig>;
200
253
  writeGlobalConfig(config: GlobalConfig): Promise<void>;
@@ -204,10 +257,39 @@ declare class Store {
204
257
  writeAppConfig(name: string, config: ConfigObject): Promise<void>;
205
258
  readChatState(name: string): Promise<ChatState>;
206
259
  writeChatState(name: string, state: ChatState): Promise<void>;
260
+ readApprovalLog(name: string): Promise<ApprovalLog>;
261
+ writeApprovalLog(name: string, log: ApprovalLog): Promise<void>;
262
+ readGrants(name: string): Promise<GrantsState>;
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>;
207
275
  readJobState(name: string): Promise<JobState>;
208
276
  writeJobState(name: string, state: JobState): Promise<void>;
209
277
  readUsageState(name: string): Promise<UsageState>;
210
278
  writeUsageState(name: string, state: UsageState): Promise<void>;
279
+ /** Appends one line to the app's turn ledger, creating the container if needed. */
280
+ appendTurnRecord(name: string, record: TurnRecord): Promise<void>;
281
+ /**
282
+ * Every parseable line of the app's turn ledger, in file order (oldest
283
+ * first); an absent file reads as no turns.
284
+ *
285
+ * An append-only log written across crashes and hand edits will eventually
286
+ * contain a truncated or malformed line. One bad line must cost only itself,
287
+ * so unparseable lines — and lines without an `at` timestamp, which nothing
288
+ * downstream could place in time — are skipped rather than thrown on.
289
+ */
290
+ readTurnRecords(name: string): Promise<TurnRecord[]>;
291
+ /** Replaces the app's turn ledger atomically (tmp file + rename), for compaction. */
292
+ writeTurnRecords(name: string, records: TurnRecord[]): Promise<void>;
211
293
  get authStatePath(): string;
212
294
  readAuthState(): Promise<AuthState>;
213
295
  writeAuthState(state: AuthState): Promise<void>;
@@ -332,72 +414,131 @@ declare const USAGE_RETENTION_DAYS = 90;
332
414
  declare function utcDay(at?: Date): string;
333
415
  /** Money for humans: sub-dollar spend needs the extra digits, larger sums don't. */
334
416
  declare function formatUsd(value: number): string;
335
- /** One turn's metering as reported by the engine; either part may be missing. */
417
+ /** One turn's metering as reported by the engine; every part may be missing. */
336
418
  interface TurnUsage {
337
419
  costUsd?: number;
338
420
  /** Per-turn token/cost deltas keyed by model id (provider-neutral). */
339
421
  modelUsage?: Record<string, ModelTokenUsage>;
340
- }
341
- /** A summary of an app's recorded spend, as served by GET /api/apps/:name/usage. */
342
- interface UsageSummary {
343
- /** The UTC day "today" refers to. */
344
- date: string;
345
- /** Spend recorded so far today. */
346
- todayCostUsd: number;
347
- /** Turns recorded so far today. */
348
- todayTurns: number;
349
- /** Per-model tokens/cost recorded so far today. */
350
- todayModels: Record<string, ModelUsageTotals>;
351
- /** Spend across the whole retention window. */
352
- totalCostUsd: number;
353
- /** Per-model tokens/cost across the whole retention window. */
354
- models: Record<string, ModelUsageTotals>;
355
- /** Days kept in the retention window. */
356
- retentionDays: number;
357
- /**
358
- * Whether the host has ever metered a turn for this app (monthly rollups
359
- * persist, so this survives the daily retention window). False means "no
360
- * data at all" — which is not the same thing as a measured zero, and must
361
- * not be rendered as `$0.0000`. The host meters only sessions an app opens
362
- * through `ctx.ai`, so an app that tracks its own costs elsewhere can be
363
- * unrecorded here while still reporting real spend of its own.
364
- */
365
- recorded: boolean;
366
- /** Daily series, oldest first; days with no spend are absent. */
367
- days: UsageDay[];
368
- /** Monthly rollups, oldest first; never pruned, so trends outlive the daily window. */
369
- months: UsageMonth[];
422
+ /** Provider session the turn belonged to, for the per-turn ledger. */
423
+ sessionId?: string;
424
+ /** Model the session ran on, as reported by the engine's session event. */
425
+ model?: string;
370
426
  }
427
+ /**
428
+ * Filters for {@link UsageRecorder.turns}; both are optional and ANDed. The
429
+ * SDK's `UsageQuery` — the same object an app passes to `ctx.usage.turns()`,
430
+ * which is this reader with the app's own name already bound.
431
+ */
432
+ type TurnQuery = UsageQuery;
433
+ /**
434
+ * A summary of an app's recorded spend, as served by GET
435
+ * /api/apps/:name/usage and returned by `ctx.usage.summary()` — the SDK's
436
+ * `AppUsageSummary`, aliased rather than restated so the endpoint, the
437
+ * dashboard, and the app contract can never drift apart.
438
+ *
439
+ * The field that carries meaning beyond its type is `recorded`: it says
440
+ * whether the host has ever metered a turn for this app (monthly rollups
441
+ * persist, so it survives the daily retention window). False means "no data at
442
+ * all" — not the same thing as a measured zero, and never to be rendered as
443
+ * `$0.0000`. The host meters only sessions an app opens through `ctx.ai`, so an
444
+ * app that tracks its own costs elsewhere can be unrecorded here while still
445
+ * reporting real spend of its own.
446
+ */
447
+ type UsageSummary = AppUsageSummary;
371
448
  /**
372
449
  * Per-app AI spend and token usage, persisted as OS bookkeeping in the app
373
- * container (`apps/<name>/usage.json`, next to jobs.json and chat.json):
374
- * a per-UTC-day series trimmed to the retention window, plus per-month
375
- * rollups that are kept forever.
450
+ * container next to jobs.json and chat.json, in two files:
451
+ *
452
+ * - `apps/<name>/turns.jsonl` — the ledger: one line per metered turn,
453
+ * append-only, oldest first, carrying the session attribution the
454
+ * aggregates throw away.
455
+ * - `apps/<name>/usage.json` — a fold over that ledger: a per-UTC-day series
456
+ * trimmed to the retention window, plus per-month rollups kept forever.
457
+ *
458
+ * The two are written together inside one per-app queue, so a turn can never
459
+ * land in one and not the other, and concurrent turns can neither lose an
460
+ * update nor interleave a half-written line. Each app has its own queue, so a
461
+ * slow write for one app never delays another.
376
462
  *
377
463
  * Cost and per-model tokens arrive from the `result` event, whose fields the
378
464
  * SDK contract marks optional: engines that report neither simply contribute
379
- * nothing. Writes are serialized per app so concurrent turns cannot lose an
380
- * update, and each app has its own queue so a slow write for one app never
381
- * delays another.
465
+ * nothing.
382
466
  */
383
467
  declare class UsageRecorder {
384
468
  private readonly store;
385
469
  private readonly retentionDays;
386
- /** Serializes usage.json read-modify-write per app. */
470
+ /** Serializes the usage.json read-modify-write and ledger append per app. */
387
471
  private readonly queues;
472
+ /** Apps whose ledger has already been compacted in this process. */
473
+ private readonly compacted;
388
474
  constructor(store: Store, retentionDays?: number);
389
475
  /**
390
- * Adds one turn's cost and token usage to the app's totals for the UTC day
391
- * and month of `at`. A missing, non-finite, or negative `costUsd` is
392
- * ignored; a turn that reports neither valid cost nor any model usage is
393
- * not counted and nothing is written, so a provider that omits metering
394
- * cannot corrupt the totals.
476
+ * Appends the turn to the app's ledger and adds its cost and token usage to
477
+ * the totals for the UTC day and month of `at`. A missing, non-finite, or
478
+ * negative `costUsd` is ignored; a turn that reports neither valid cost nor
479
+ * any model usage is not counted and nothing is written at all, so a
480
+ * provider that omits metering cannot corrupt the totals.
481
+ *
482
+ * Both writes happen in the same queued unit of work, ledger first: if the
483
+ * aggregate write then fails, the ledger is *ahead* of usage.json and
484
+ * `rebuild()` can recover the turn. The other order would lose it.
395
485
  */
396
486
  record(appName: string, turn: TurnUsage, at?: Date): Promise<void>;
397
487
  /** The app's recorded usage, oldest first, with expired days filtered out. */
398
488
  read(appName: string, at?: Date): Promise<Required<UsageState>>;
399
489
  /** Today's spend plus the daily/monthly series, for the dashboard and the usage endpoints. */
400
490
  summary(appName: string, at?: Date): Promise<UsageSummary>;
491
+ /**
492
+ * The app's metered turns, oldest first, with expired lines excluded.
493
+ *
494
+ * `since` is an inclusive lower bound compared lexically against the ISO
495
+ * `at` (so a plain `YYYY-MM-DD` works as "from that day on"), `sessionId`
496
+ * narrows to one provider session, and both are ANDed. This is the one
497
+ * reader for the ledger: everything that needs per-turn detail goes through
498
+ * it rather than parsing the file itself.
499
+ */
500
+ turns(appName: string, query?: TurnQuery, at?: Date): Promise<TurnRecord[]>;
501
+ /**
502
+ * Rewrites the app's ledger without the lines that have aged out of the
503
+ * retention window (the same window usage.json days use). Unparseable lines
504
+ * are dropped by the same rewrite, since only parsed records are written
505
+ * back.
506
+ *
507
+ * Runs inside the per-app queue, so it can never race a turn being
508
+ * appended. Pure bookkeeping: callers should treat a failure as noise, not
509
+ * as a reason to fail whatever they were doing.
510
+ */
511
+ compact(appName: string, at?: Date): Promise<void>;
512
+ /**
513
+ * Rebuilds usage.json from turns.jsonl, for when the two have drifted apart
514
+ * (a lost write, a crash mid-fold, a hand edit). The result is exactly what
515
+ * the incremental fold in `record()` would have produced from the same
516
+ * lines: same day and month buckets, same turn counts, same per-model
517
+ * totals, same rounding.
518
+ *
519
+ * Caveat, by construction: the ledger is pruned at `retentionDays` but
520
+ * usage.json months are kept forever, so months the ledger no longer covers
521
+ * cannot be recomputed. Those keep their existing rollup and only the
522
+ * months the ledger does cover are replaced — a rebuild never silently
523
+ * erases older history. The one month that is *partially* covered (the one
524
+ * the retention cutoff falls in) is replaced by its in-window part, which is
525
+ * all the ledger can still account for.
526
+ *
527
+ * Returns the state it wrote.
528
+ */
529
+ rebuild(appName: string, at?: Date): Promise<Required<UsageState>>;
530
+ /** The oldest UTC day still inside the retention window at `at`. */
531
+ private cutoff;
532
+ private inWindow;
533
+ /** The compaction body; assumes it is already inside the app's queue. */
534
+ private compactNow;
535
+ /**
536
+ * Trims the ledger on the app's first append of the process, so a host that
537
+ * is never restarted still sheds expired lines. Compaction is bookkeeping
538
+ * and must never break a turn, so a failure is swallowed — the next process
539
+ * tries again, and meanwhile `turns()` filters expired lines out anyway.
540
+ */
541
+ private compactOnce;
401
542
  private apply;
402
543
  /**
403
544
  * One-time migration for files written before monthly rollups existed:
@@ -629,6 +770,121 @@ interface ResolvedApp {
629
770
  /** Finds an app by name across configured registries (refreshing caches). */
630
771
  declare function resolveApp(store: Store, appName: string): Promise<ResolvedApp>;
631
772
  //#endregion
773
+ //#region src/approvals.d.ts
774
+ type ApprovalRequired = Extract<AgentEvent, {
775
+ type: "approval_required";
776
+ }>;
777
+ type ApprovalResolved = Extract<AgentEvent, {
778
+ type: "approval_resolved";
779
+ }>;
780
+ /**
781
+ * Host-wide bookkeeping for interactive tool approvals. Sessions wrapped by
782
+ * `superviseSession` register every `approval_required` here, so chat turns
783
+ * and cron jobs alike show up in one pending list; decisions flow back through
784
+ * `respond()` to the provider, and every outcome is appended to the app's
785
+ * `approvals.json` log. The registry also arms the host's timeout policy:
786
+ * a request nobody decides is denied after {@link DEFAULT_APPROVAL_TIMEOUT_MS}
787
+ * (overridable via `approvalTimeoutSeconds` in the global config — host
788
+ * policy, like budgets).
789
+ *
790
+ * Always-allow grants (`grants.json`) are written here too, so ask→allow
791
+ * promotion stays inside manifest bounds in one place.
792
+ */
793
+ declare class ApprovalRegistry {
794
+ #private;
795
+ constructor(store: Store, options?: {
796
+ timeoutMs?: number;
797
+ });
798
+ /** Applies the host-config timeout override; safe to fire-and-forget at boot. */
799
+ init(): Promise<void>;
800
+ /** Registers a provider-born approval request and arms the auto-deny timer. */
801
+ track(app: string, event: ApprovalRequired, respond: (decision: ApprovalDecision) => Promise<void>): void;
802
+ /** Attaches the conversation a chat-born approval belongs to (cron ones have none). */
803
+ annotate(approvalId: string, fields: {
804
+ conversationId: string;
805
+ }): void;
806
+ /** The pending or settled record, for endpoint lookups. */
807
+ get(approvalId: string): ApprovalRecord | undefined;
808
+ /** Snapshots of pending records, optionally narrowed; newest last. */
809
+ pending(filter?: {
810
+ app?: string;
811
+ conversationId?: string;
812
+ }): ApprovalRecord[];
813
+ /**
814
+ * Applies a user decision: settles the record, then forwards the decision to
815
+ * the session that is suspended on it. Returns 'unknown' for an id this host
816
+ * never saw and 'resolved' for one already decided, so the endpoint can tell
817
+ * 404 from 409.
818
+ */
819
+ respond(approvalId: string, decision: ApprovalDecision): "ok" | "unknown" | "resolved";
820
+ /**
821
+ * Observes a provider-side resolution (session closed, interrupt) arriving
822
+ * through the event stream. A registry-initiated decision already settled
823
+ * the record, so this is a no-op for it.
824
+ */
825
+ resolved(event: ApprovalResolved): void;
826
+ /**
827
+ * Marks an approval whose session's event stream ended without a resolution
828
+ * (crash, abrupt close) as denied, so nothing stays pending forever.
829
+ */
830
+ abandon(approvalId: string): void;
831
+ /** Reads the app's always-allow grants. */
832
+ grants(app: string): Promise<string[]>;
833
+ /**
834
+ * Persists an always-allow grant. Validated against the manifest's askTools:
835
+ * a grant can promote ask→allow but never allow a tool the manifest did not
836
+ * declare askable.
837
+ */
838
+ addGrant(app: string, tool: string, askTools: string[]): Promise<void>;
839
+ /** Clears timers and denies everything still pending (host shutdown). */
840
+ close(): void;
841
+ /** Resolves when all queued approvals.json writes have landed (tests). */
842
+ flush(): Promise<void>;
843
+ }
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
632
888
  //#region src/runtime.d.ts
633
889
  /**
634
890
  * Builds the AppContext for an installed app: merges the config layers
@@ -641,10 +897,13 @@ declare function resolveApp(store: Store, appName: string): Promise<ResolvedApp>
641
897
  * while required keys are missing the scoped provider fails closed.
642
898
  *
643
899
  * When a `usage` recorder is supplied, every session opened through the
644
- * returned context reports its per-turn cost to it, and the app's host-set
645
- * daily spend cap (if any) is enforced on every createSession.
900
+ * returned context reports its per-turn cost to it, the app's host-set daily
901
+ * spend cap (if any) is enforced on every createSession, and `ctx.usage` reads
902
+ * back the app's own ledger. Without one there is no metering, no cap, and
903
+ * `ctx.usage` answers "nothing recorded" — the member is required by the
904
+ * contract, so it is always present.
646
905
  */
647
- declare function buildAppContext(store: Store, manifest: AppManifest, provider: AIProvider, usage?: UsageRecorder): Promise<AppContext>;
906
+ declare function buildAppContext(store: Store, manifest: AppManifest, provider: AIProvider, usage?: UsageRecorder, approvals?: ApprovalRegistry, gateway?: ToolGateway): Promise<AppContext>;
648
907
  //#endregion
649
908
  //#region src/scheduler.d.ts
650
909
  interface SchedulableApp {
@@ -733,21 +992,42 @@ interface ServerOptions {
733
992
  * GET /api/apps/:name/usage recorded AI spend: today's total, a daily series,
734
993
  * per-model token totals, monthly rollups,
735
994
  * `recorded`, and the budget status
995
+ * GET /api/apps/:name/turns the per-turn ledger that summary folds: `{ turns }`,
996
+ * oldest first, each with `at`, `costUsd`, and the
997
+ * session/model attribution the buckets drop.
998
+ * ?since=<timestamp> (inclusive) and ?session=<id>
999
+ * narrow it, ANDed; an unreadable `since` is a 400
736
1000
  * GET /api/apps/:name/budget today's spend against the app's daily cap,
737
1001
  * plus `recorded`
738
1002
  * PUT /api/apps/:name/budget { dailyUsd: number | null } -> set or clear the cap
739
1003
  * (a host setting; apps cannot set their own)
740
- * POST /api/apps/:name/chat { message, conversationId? } -> SSE stream of AgentEvents
741
- * (omit conversationId to start a new conversation; the
742
- * id is echoed in the x-conversation-id response header;
743
- * 402 when the app is over its daily spend cap)
1004
+ * POST /api/apps/:name/chat { message, conversationId? } -> 202 { conversationId };
1005
+ * the turn runs detached and its AgentEvents are published
1006
+ * on the conversation's event bus (omit conversationId to
1007
+ * start a new conversation; the id is also echoed in the
1008
+ * x-conversation-id response header; 402 when the app is
1009
+ * over its daily spend cap)
1010
+ * GET /api/apps/:name/chat/:conversationId/events standing SSE from the conversation
1011
+ * bus: replay from Last-Event-ID (or ?lastEventId=), then
1012
+ * live; a scrolled-out id gets a `resync` event first
1013
+ * GET /api/apps/:name/chat/:conversationId/pending-approvals reconnect snapshot of
1014
+ * undecided tool approvals for this conversation
1015
+ * POST /api/apps/:name/chat/:conversationId/approvals/:approvalId
1016
+ * { behavior: "allow"|"deny", scope?, message? } -> decide a
1017
+ * pending approval (scope "always" persists a grant);
1018
+ * 404 unknown/expired, 409 already decided
1019
+ * GET /api/approvals host-wide pending tool approvals (chat and cron alike)
1020
+ * POST /api/approvals/:approvalId decide a pending approval regardless of source
744
1021
  * GET /api/apps/:name/chat/conversations conversations, most recent first
745
1022
  * POST /api/apps/:name/chat/conversations { sessionId?, title? } -> create a conversation,
746
1023
  * optionally adopting an existing provider session (e.g. an
747
1024
  * app-run investigation) so chat continues where it left off
748
1025
  * GET /api/apps/:name/chat/:conversationId/history past turns from the provider transcript
1026
+ * plus the conversation's settled approval records
749
1027
  * GET /api/apps/:name/jobs manifest-declared jobs with schedule/status
750
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)
751
1031
  * GET /api/apps/:name/manifest read-only app definition: instructions, agents,
752
1032
  * skills (with dir contents), allowed tools,
753
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/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;;;UC9CzD;EACf;EACA;;;UAIe;;;;;EAKf;;;;;;;;;;;;;;KAeU;;UAGK;EACf,OAAO;;;;;;EAMP;;;;;;;EAOA;;UAGe;EACf,YAAY;EACZ;;EAEA;;EAEA,OAAO;;EAEP,OAAO,eAAe;;;;;;;;;EAStB,UAAU,eAAe;;UAGV;EACf;;EAEA;EACA;EACA;;;UAIe;EACf,eAAe;;UAGA;EACf;EACA;EACA;EACA;EACA;EACA;;;UAIe;EACf,SAAS;EACT,MAAM;;;UAIS;EACf;EACA;EACA;EACA;EACA;;;UAIe;;EAEf;;EAEA;;EAEA;;EAEA,SAAS,eAAe;;;UAIT;;EAEf;EACA;EACA;EACA,SAAS,eAAe;;;;;;;;UAST;EACf,MAAM;EACN,SAAS;;;UAIM;EACf;EACA;EACA;EACA;EACA;;;UAIe;EACf;;EAEA;EACA;EACA;EACA;;;UAIe;EACf,QAAQ;EACR,UAAU;;UAGK;EACf;EACA;;EAEA;EACA,QAAQ;EACR;EACA;;;;;;;cAwBW;WACF;EAET,YAAY;MAIR;MAIA;MAIA;MAIA;;EAKJ,OAAO;EAOP,WAAW;EAIX,WAAW;EAIX,cAAc;EAId,cAAc;EAId,iBAAiB;EAIjB,gBAAgB;EAIhB,aAAa;EAIb,kBAAkB;EAOlB,oBAA0B,QAAQ;EAIlC,kBAAwB,QAAQ,eAAe;EAI/C,cAAoB,eAAe,QAAQ;EAI3C,eAAqB,QAAQ,gBAAgB;EAI7C,cAAoB,eAAe,QAAQ;EAI3C,eAAqB,cA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AO,OACP,UAAU,YACV,sBACC,QAAQ;;;UC3TM;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf,MAAM;;;;;;;iBAkCc,gBAAgB,OAAO,OAAO,UAAU,cAAc,QAAQ;iBAuB9D,gBACpB,OAAO,OACP,eACC,QAAQ;iBASW,YAAY,OAAO,OAAO,cAAc,cAAc,QAAQ;iBAW9D,eAAe,OAAO,OAAO,eAAe;UAWjD;EACf;EACA,KAAK;;;iBAIe,WAAW,OAAO,OAAO,kBAAkB,QAAQ;;;;;;;;;;;;;;;;;iBCmFnD,gBACpB,OAAO,OACP,UAAU,aACV,UAAU,YACV,QAAQ,gBACP,QAAQ;;;UCrMM;EACf,UAAU;EACV,KAAK;EACL,cAAc,gBAAgB,KAAK,eAAe;;UAGnC;EACf;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA,YAAY;;;;;;;;cAiBD;mBAQT;mBACA;UARM;UACA;UACA;;UAEA;EAER,YACE,OAAwB,OACxB,SAA0B,iBAAiB,QAAQ;EAGrD,SAAe;EAuCf;;MAOI;;;;;EAQJ,IACE,iBACA,iBACA,UAAS,oBACR,QAAQ;;EAmCX,OAAa,kBAAkB,QAAQ;UA4B/B;;;;UCtDO;;EAEf,KAAK;;EAEL,WAAW;;EAEX,MAAM;;EAEN,SAAS;;UAGM;;EAEf,OAAO;;;;;;EAMP,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkDL,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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B,QAAQ;;EAOR,OAAa,cAAc;;;;;;EAS3B,SAAe,aAAa,cAAc,qBAAqB;;EAW/D;;EAoDA,SAAS;;;;;UC5LM;EACf,MAAM;;EAEN;;;;;;;;;;;;;;;;;cAkBW;;EAQX,YAAY,OAAO;;EAKnB,QAAQ,aAAa,gBAAgB,iBAAiB;;EAOtD,WAAiB,cAAc,QAAQ;;;;;;;;EAsBvC,cAAoB,oBAAoB,UAAU,mBAAmB;;EAkBrE,YAAkB,aAAa,iBAAc,QAAQ;;EAOrD,SAAS;;;;;;;;;;;;;;;;;;;;;iBC4RW,gBACpB,OAAO,OACP,UAAU,aACV,UAAU,YACV,QAAQ,eACR,YAAY,kBACZ,UAAU,cACT,QAAQ;;;UCvZM;EACf,UAAU;EACV,KAAK;EACL,cAAc,gBAAgB,KAAK,eAAe;;UAGnC;EACf;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA,YAAY;;;;;;;;cAiBD;mBAQT;mBACA;UARM;UACA;UACA;;UAEA;EAER,YACE,OAAwB,OACxB,SAA0B,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-DoAGOynU.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 };