@frockbot/plugin-shell 0.3.17 → 0.3.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frockbot/plugin-shell",
3
- "version": "0.3.17",
3
+ "version": "0.3.19",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -26,6 +26,7 @@
26
26
  "./debug-protocol": "./src/debug-protocol.ts",
27
27
  "./client/FrockBotApp.vue": "./src/client/FrockBotApp.vue",
28
28
  "./client/notify": "./src/client/notify.ts",
29
+ "./client/voice-microphone": "./src/client/voice-microphone.ts",
29
30
  "./client/styles.css": "./src/client/styles.css",
30
31
  "./client/voice-worklet": "./src/client/voice-worklet.ts",
31
32
  "./focus": "./src/focus.ts",
@@ -51,42 +52,42 @@
51
52
  },
52
53
  "dependencies": {
53
54
  "@cordisjs/plugin-webui": "0.8.2",
54
- "@frockbot/agent-runtime": "0.3.17",
55
- "@frockbot/application-foundation": "0.3.17",
56
- "@frockbot/catalog-core": "0.3.17",
57
- "@frockbot/client-core": "0.3.17",
58
- "@frockbot/client-ui": "0.3.17",
59
- "@frockbot/computer-core": "0.3.17",
60
- "@frockbot/computer-host-protocol": "0.3.17",
61
- "@frockbot/configuration-core": "0.3.17",
62
- "@frockbot/connection-core": "0.3.17",
63
- "@frockbot/kernel-agent-loop": "0.3.17",
64
- "@frockbot/kernel-composition": "0.3.17",
65
- "@frockbot/kernel-contracts": "0.3.17",
66
- "@frockbot/kernel-do": "0.3.17",
67
- "@frockbot/machine-protocol": "0.3.17",
68
- "@frockbot/plugin-applets": "0.3.17",
69
- "@frockbot/plugin-authoring": "0.3.17",
70
- "@frockbot/plugin-bot-template": "0.3.17",
71
- "@frockbot/plugin-computer": "0.3.17",
72
- "@frockbot/plugin-flock": "0.3.17",
73
- "@frockbot/plugin-image": "0.3.17",
74
- "@frockbot/plugin-machine-messages": "0.3.17",
75
- "@frockbot/plugin-mcp": "0.3.17",
76
- "@frockbot/plugin-memory": "0.3.17",
77
- "@frockbot/plugin-package-catalog": "0.3.17",
78
- "@frockbot/plugin-routines": "0.3.17",
79
- "@frockbot/plugin-skills": "0.3.17",
80
- "@frockbot/plugin-subagents": "0.3.17",
81
- "@frockbot/plugin-user-machine": "0.3.17",
82
- "@frockbot/protocol": "0.3.17",
55
+ "@frockbot/agent-runtime": "0.3.19",
56
+ "@frockbot/application-foundation": "0.3.19",
57
+ "@frockbot/catalog-core": "0.3.19",
58
+ "@frockbot/client-core": "0.3.19",
59
+ "@frockbot/client-ui": "0.3.19",
60
+ "@frockbot/computer-core": "0.3.19",
61
+ "@frockbot/computer-host-protocol": "0.3.19",
62
+ "@frockbot/configuration-core": "0.3.19",
63
+ "@frockbot/connection-core": "0.3.19",
64
+ "@frockbot/kernel-agent-loop": "0.3.19",
65
+ "@frockbot/kernel-composition": "0.3.19",
66
+ "@frockbot/kernel-contracts": "0.3.19",
67
+ "@frockbot/kernel-do": "0.3.19",
68
+ "@frockbot/machine-protocol": "0.3.19",
69
+ "@frockbot/plugin-applets": "0.3.19",
70
+ "@frockbot/plugin-authoring": "0.3.19",
71
+ "@frockbot/plugin-bot-template": "0.3.19",
72
+ "@frockbot/plugin-computer": "0.3.19",
73
+ "@frockbot/plugin-flock": "0.3.19",
74
+ "@frockbot/plugin-image": "0.3.19",
75
+ "@frockbot/plugin-machine-messages": "0.3.19",
76
+ "@frockbot/plugin-mcp": "0.3.19",
77
+ "@frockbot/plugin-memory": "0.3.19",
78
+ "@frockbot/plugin-package-catalog": "0.3.19",
79
+ "@frockbot/plugin-routines": "0.3.19",
80
+ "@frockbot/plugin-skills": "0.3.19",
81
+ "@frockbot/plugin-subagents": "0.3.19",
82
+ "@frockbot/plugin-user-machine": "0.3.19",
83
+ "@frockbot/protocol": "0.3.19",
83
84
  "cordis": "4.0.0-rc.8",
84
85
  "vue": "3.5.41"
85
86
  },
86
87
  "devDependencies": {
87
88
  "@cloudflare/workers-types": "latest",
88
- "@frockbot/plugin-prompt": "0.3.17",
89
- "@frockbot/plugin-tools": "0.3.17",
89
+ "@frockbot/plugin-prompt": "0.3.19",
90
+ "@frockbot/plugin-tools": "0.3.19",
90
91
  "@types/bun": "1.3.6",
91
92
  "@types/node": "26.2.0",
92
93
  "@vitejs/plugin-vue": "6.0.8",
package/src/backend.ts CHANGED
@@ -60,6 +60,7 @@ import {
60
60
  type BotDurableAuthorityOptions,
61
61
  type BotTurnExecutionInput,
62
62
  type OwnedBotTurnCommand,
63
+ type StoredRunOriginV1,
63
64
  } from "@frockbot/kernel-do";
64
65
  import type {
65
66
  FoundationAgentPackage,
@@ -681,6 +682,15 @@ export interface ShellBotBackendHost {
681
682
  turn: number;
682
683
  events: readonly SessionEvent[];
683
684
  }): Promise<void>;
685
+ /** A Package-neutral hook for an agent Turn's durable terminal projection. */
686
+ recordSettledAgentOutcome?(input: {
687
+ userId: string;
688
+ botId: string;
689
+ runId: string;
690
+ turn: number;
691
+ origin?: StoredRunOriginV1;
692
+ events: readonly SessionEvent[];
693
+ }): Promise<void>;
684
694
  }
685
695
 
686
696
  /** The narrow storage seam the Bot's announcement log is written through. */
@@ -784,6 +794,7 @@ export class ShellBotBackendContribution {
784
794
  private readonly hostDeferScheduledWork?: ShellBotBackendHost["deferScheduledWork"];
785
795
  private readonly hostSettleScheduledWork?: ShellBotBackendHost["settleScheduledWork"];
786
796
  private readonly recordSettledUsage?: ShellBotBackendHost["recordSettledUsage"];
797
+ private readonly recordSettledAgentOutcome?: ShellBotBackendHost["recordSettledAgentOutcome"];
787
798
 
788
799
  constructor(host: ShellBotBackendHost) {
789
800
  this.ctx = host.state;
@@ -800,6 +811,7 @@ export class ShellBotBackendContribution {
800
811
  this.hostDeferScheduledWork = host.deferScheduledWork;
801
812
  this.hostSettleScheduledWork = host.settleScheduledWork;
802
813
  this.recordSettledUsage = host.recordSettledUsage;
814
+ this.recordSettledAgentOutcome = host.recordSettledAgentOutcome;
803
815
  const routines = createBotRoutines(
804
816
  host.state.storage,
805
817
  createBotRoutineHookMinter(
@@ -1759,14 +1771,34 @@ export class ShellBotBackendContribution {
1759
1771
  input.command.sessionId,
1760
1772
  effect,
1761
1773
  ),
1762
- ...(this.recordSettledUsage
1774
+ ...(this.recordSettledUsage || this.recordSettledAgentOutcome
1763
1775
  ? {
1764
- onTurnStopping: (settled) =>
1765
- this.recordSettledUsage!({
1766
- botId: input.identity.botId,
1767
- runId: input.command.runId,
1768
- ...settled,
1769
- }),
1776
+ onTurnStopping: async (settled) => {
1777
+ await Promise.allSettled([
1778
+ ...(this.recordSettledUsage
1779
+ ? [
1780
+ this.recordSettledUsage({
1781
+ botId: input.identity.botId,
1782
+ runId: input.command.runId,
1783
+ ...settled,
1784
+ }),
1785
+ ]
1786
+ : []),
1787
+ ...(this.recordSettledAgentOutcome
1788
+ ? [
1789
+ this.recordSettledAgentOutcome({
1790
+ userId: input.identity.userId,
1791
+ botId: input.identity.botId,
1792
+ runId: input.command.runId,
1793
+ ...(input.command.origin
1794
+ ? { origin: input.command.origin }
1795
+ : {}),
1796
+ ...settled,
1797
+ }),
1798
+ ]
1799
+ : []),
1800
+ ]);
1801
+ },
1770
1802
  }
1771
1803
  : {}),
1772
1804
  ...(isolate ? { isolate } : {}),
@@ -5302,6 +5334,12 @@ export class ShellBotBackendContribution {
5302
5334
  };
5303
5335
  }
5304
5336
 
5337
+ /** Count inputs waiting for the next conversational Turn without draining them. */
5338
+ async pendingInputCount(identity: BotIdentity): Promise<number> {
5339
+ await this.validateIdentity(identity);
5340
+ return (await this.routineInbox.pending()).length;
5341
+ }
5342
+
5305
5343
  /**
5306
5344
  * Acknowledge inbox entries. An explicit command, never a side effect of
5307
5345
  * reading: a background poll must not clear the badge.
@@ -21,10 +21,14 @@ export interface VoiceMicrophoneV1 {
21
21
  }
22
22
 
23
23
  export interface VoiceMicrophoneOptionsV1 {
24
- /** One frame of PCM16, little-endian, mono, 24 kHz. */
24
+ /** One frame of PCM16, little-endian, mono, at `sampleRate`. */
25
25
  audio(pcm16: ArrayBuffer): void;
26
26
  /** Peak amplitude of the frame, 0…1, for the capture animation. */
27
27
  level(value: number): void;
28
+ /** Defaults to dictation's 24 kHz. Voice assistant input uses 16 kHz. */
29
+ sampleRate?: number;
30
+ /** Defaults to 32 ms at the selected sample rate. */
31
+ frameSamples?: number;
28
32
  }
29
33
 
30
34
  /** False on a platform with no microphone API at all; the button stays hidden. */
@@ -83,8 +87,14 @@ export async function startVoiceMicrophoneV1(
83
87
  numberOfOutputs: 1,
84
88
  outputChannelCount: [1],
85
89
  processorOptions: {
86
- targetRate: VOICE_CAPTURE_SAMPLE_RATE_V1,
87
- frameSamples: FRAME_SAMPLES,
90
+ targetRate: options.sampleRate ?? VOICE_CAPTURE_SAMPLE_RATE_V1,
91
+ frameSamples:
92
+ options.frameSamples ??
93
+ Math.round(
94
+ FRAME_SAMPLES *
95
+ ((options.sampleRate ?? VOICE_CAPTURE_SAMPLE_RATE_V1) /
96
+ VOICE_CAPTURE_SAMPLE_RATE_V1),
97
+ ),
88
98
  },
89
99
  });
90
100
  node.port.onmessage = (event: MessageEvent) => {