{"version":3,"file":"steer-command.d.ts","sourceRoot":"","sources":["../../src/core/steer-command.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAC7D,eAAO,MAAM,kCAAkC,wLACuI,CAAC;AAEvL,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE;QACN,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;KACzC,CAAC;IACF,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,mBAAmB,IAAI,SAAS,MAAM,EAAE,CAAC;CACzC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQlE;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlG","sourcesContent":["export const STEER_COMMAND_NAME = \"/steer\";\nexport const STEER_COMMAND_USAGE = \"Usage: /steer <message>\";\nexport const STEER_COMMAND_ACTIVE_WORK_REQUIRED =\n\t\"/steer needs an active workstream. Use it while Jensen is working, or after an assistant response to continue the current work. It does not create a new standalone task by itself.\";\n\nexport interface SteerCommandMessage {\n\trole: string;\n}\n\nexport interface SteerCommandTarget {\n\tisStreaming: boolean;\n\tstate: {\n\t\tmessages: readonly SteerCommandMessage[];\n\t};\n\tsteer(text: string): Promise<void>;\n\tcontinueCurrentWork(): Promise<void>;\n\tgetSteeringMessages(): readonly string[];\n}\n\nexport function parseSteerCommand(text: string): string | undefined {\n\tconst trimmed = text.trim();\n\tif (!trimmed.toLowerCase().startsWith(`${STEER_COMMAND_NAME} `)) {\n\t\treturn undefined;\n\t}\n\n\tconst message = trimmed.slice(STEER_COMMAND_NAME.length).trim();\n\treturn message.length > 0 ? message : undefined;\n}\n\nexport async function runSteerCommand(target: SteerCommandTarget, message: string): Promise<string> {\n\tif (target.isStreaming) {\n\t\tawait target.steer(message);\n\t\treturn (\n\t\t\t\"Queued steering for the active workstream. It will be delivered after the current assistant turn finishes its current tool work, before the next model call. \" +\n\t\t\t`Pending steering messages: ${target.getSteeringMessages().length}.`\n\t\t);\n\t}\n\n\tconst lastMessage = target.state.messages[target.state.messages.length - 1];\n\tif (lastMessage?.role !== \"assistant\") {\n\t\tthrow new Error(STEER_COMMAND_ACTIVE_WORK_REQUIRED);\n\t}\n\n\tawait target.steer(message);\n\tawait target.continueCurrentWork();\n\treturn (\n\t\t\"Submitted steering for the active workstream and resumed from the latest assistant turn. \" +\n\t\t\"This is not live mid-thought interruption; it starts a continuation turn from the current session state.\"\n\t);\n}\n"]}