okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
1306424be
main
1/** 2* The agent preset the app's chats run under: the Harness's `standard` preset (pinned 57190202, 3* packages/bundle/web-app/presets/standard.patch.yml) with the differences the app needs, and nothing else. 4* 5* A patch replaces the whole preset row, so the list is restated here. `tests/agent-tools.test.mjs` compares this list 6* with the pinned Harness's own file (when STRATA_HARNESS_DIR is set), so a Harness update that adds or renames a 7* plugin fails a test instead of silently dropping a tool. 8* 9* Differences from `standard`, each with its reason: 10* - `tool-schedule` removed: the app has one scheduler (server/tasks.mjs, the Tasks screen); a second set of 11* reminder tools would run behind its back. 12* - `web_search` removed (tool-web with `search:false`): every search backend the Harness has needs a service key 13* the app does not have, so the tool could only fail. `web_fetch` stays. (`searchProvider` can switch it back on.) 14* - `tool-ask-user` stays (it is the group "Questions for you" in Settings -> Tools): the app shows the agent's own questions in a card above 15* the message box and sends the answer back (#4244). Switched off, the tool is not offered and the agent asks in plain text. 16* - the `planning` group (Harness plan mode and `exit_plan_mode`) removed: the app's Plan mode is the permission 17* preset (nothing can change); the Harness's plan mode needs an interactive review the app does not have. 18* - `tool-bash` / `tool-pwsh`: exactly one, by operating system (the Harness chooses the same at load). 19* - `tool-plugin-manager` stays disabled, as in `standard`. 20* - The goal, skill, workflow and fork tools are kept (owner decision): the first message is slower, and the short plain system prompt below keeps it as small as it can be. 21*/ 22 23import { withoutDisabled } from './tools-catalog.mjs' ; 24 25/** Plugin ids of the pinned Harness `standard` preset, in its order (the drift check). */ 26export const STANDARD_PLUGIN_IDS = [ 27'persona' , 'agent-instructions' , 'time-context' , 'tool-bash' , 'tool-pwsh' , 'tool-fs' , 'tool-fs-search' , 'tool-jobs' , 28'tool-schedule' , 'skill-filesystem' , 'tool-skill' , 'command-goal' , 'tool-goal' , 'planning' , 'compaction' , 'delegation' , 29'tool-ask-user' , 'tool-todo' , 'tool-web' , 'present' , 'tool-plugin-manager' , 30]; 31/** What we leave out of it. */ 32export const REMOVED_PLUGIN_IDS = [ 'tool-schedule' , 'planning' ]; 33/** Plugins removed from inside the `delegation` group (the group stays: helper agents are a feature). */ 34export const REMOVED_DELEGATION_IDS = []; 35 36/** 37* The whole system prompt of an app chat. The Harness's own text is about 4.8 KB (about 1,200 tokens) of guidance for working on 38* the Harness itself (its checkout, its web page, its plugins): a local model pays for it on every first message and the person 39* can see its words in the chat ("DSH", "sandbox"). This one says what a chat needs and nothing else. The tools state their own rules. 40*/ 41export const AGENT_PROMPT = [ 42'You are a helpful assistant that can also work on this computer through your tools. You are running as {{model}}.' , 43'Answer questions directly and briefly; use a tool only when the task needs one. The person reads your replies in a chat: use plain words, not tool names or technical jargon.' , 44'Look before you change: read a file before you edit or overwrite it, and prefer a small edit to a rewrite. Search with the glob and grep tools and read files with the read tool; use the shell for running programs.' , 45'A command that starts a program, folder or page only tells you that it started. Never say a window opened, a page rendered or that you checked how it looks unless a tool confirmed it. If a command fails, say what went wrong in one sentence and what you will try next.' , 46'To show the person an image, SVG, HTML page or PDF from their folders, use the present tool: the app shows it next to the chat. A browser cannot open file:// addresses. If you do start a program, start it so the command returns at once and never wait for it to close: Start-Process on Windows, open on macOS, xdg-open on Linux.' , 47'When the person asks you to ask a subagent, a helper or another model ("ask a subagent", "ask model X"), use the subagent tool and name the model in its model field. Never look for a model with shell commands, and never wait for a helper with sleep: end your turn; its answer arrives as a new message.' , 48'Tokens prefixed with @ are files or folders the person pointed at. A failed or refused action changed nothing; say so, and do not claim work you did not do.' , 49]. join ( '\n\n' ); 50 51/** 52* The one sentence that says which computer this is. The Harness's own runtime context is off (see `includeRuntimeContext` below), so without it 53* a model on Windows spent its first steps on `ls`, `uname` and `wc` before trying PowerShell commands (and some ran out of steps first). 54*/ 55export const OS_LINES = { 56win32 :'This computer runs Windows and the shell tool is PowerShell: uname, wc and grep do not exist here; use Get-ChildItem, Get-Content, Select-String and Measure-Object. There is no need to check which system this is.' , 57darwin :'This computer runs macOS and the shell tool is a Unix shell. There is no need to check which system this is.' , 58linux :'This computer runs Linux and the shell tool is a Unix shell. There is no need to check which system this is.' , 59}; 60 61/** AGENT_PROMPT with the sentence for `platform` after its first line. */ 62export function agentPromptFor ( platform = process . platform ) { 63const line = OS_LINES [ platform ]; 64if ( ! line ) return AGENT_PROMPT ; 65const [ first , ...rest ] = AGENT_PROMPT . split ( '\n\n' ); 66return [ first , line , ...rest ]. join ( '\n\n' ); 67} 68 69/** 70* @param { {platform?: string, search?: boolean} } [options] 71* @returns { object } the `config` of the `preset-standard` row 72*/ 73export function standardPreset ({ platform= process . platform , search= false , off= new Set (), skillsDir= null , compaction= [] } = {}) { 74const windows = platform === 'win32' ; 75const plugins = [ 76{ id :'persona' , name :'@deepseek-ai/dsh-persona' , config :{ prefix :agentPromptFor ( platform ), complete :true , includeRuntimeContext :false } }, 77{ id :'agent-instructions' , name :'@deepseek-ai/dsh-agent-instructions' , config :{ maxBytes :65536 } }, 78{ id :'time-context' , name :'@deepseek-ai/dsh-time-context' }, 79windows 80 ?{ id :'tool-pwsh' , name :'@deepseek-ai/dsh-tool-pwsh' } 81 :{ id :'tool-bash' , name :'@deepseek-ai/dsh-tool-bash' }, 82{ id :'tool-fs' , name :'@deepseek-ai/dsh-tool-fs' }, 83{ id :'tool-fs-search' , name :'@deepseek-ai/dsh-tool-fs-search' , config :{ sampleOverCapGlobResults :false } }, 84{ id :'tool-jobs' , name :'@deepseek-ai/dsh-tool-jobs' }, 85// The skills of the Skills page, written out as folders the Harness scans (and watches: a skill saved in the app is there at once). 86{ id :'skill-filesystem' , name :'@deepseek-ai/dsh-skill-filesystem' , ...( skillsDir ?{ config :{ customSkillDirs :[ skillsDir ] } } :{}) }, 87{ id :'tool-skill' , name :'@deepseek-ai/dsh-tool-skill' }, 88{ id :'command-goal' , name :'@deepseek-ai/dsh-command-goal' }, 89{ id :'tool-goal' , name :'@deepseek-ai/dsh-tool-goal' }, 90{ 91id :'compaction' , name :'cordis:group' , group :true , isolate :{ compaction :true , toolResultPruner :true }, 92config :[ 93{ id :'compaction-basic' , name :'@deepseek-ai/dsh-compaction-basic' , ...( compaction . length ?{ config :{ modelPolicies :compaction } } :{}) }, 94{ id :'command-compact' , name :'@deepseek-ai/dsh-command-compact' }, 95{ id :'tool-result-pruner' , name :'@deepseek-ai/dsh-compaction-tool-result-pruner' , config :{ thresholdChars :8192 , headChars :4096 , tailChars :1024 } }, 96], 97}, 98{ 99id :'delegation' , name :'cordis:group' , group :true , isolate :{ workflowEngine :true }, 100config :[ 101{ id :'tool-subagent-control' , name :'@deepseek-ai/dsh-tool-subagent-control' }, 102{ id :'tool-subagent-list-agents' , name :'@deepseek-ai/dsh-tool-subagent-control/list-agents' }, 103{ id :'tool-subagent' , name :'@deepseek-ai/dsh-tool-subagent' , config :{ provider :'spawn' , toolName :'subagent' , modelSelectionSettings :true } }, 104{ id :'tool-subagent-fork' , name :'@deepseek-ai/dsh-tool-subagent' , config :{ provider :'fork' , toolName :'subagent_fork' } }, 105{ id :'workflow-ptc' , name :'@deepseek-ai/dsh-workflow-ptc' , config :{ provider :'spawn' } }, 106{ id :'tool-workflow' , name :'@deepseek-ai/dsh-tool-workflow' }, 107], 108}, 109{ id :'tool-ask-user' , name :'@deepseek-ai/dsh-tool-ask-user' }, 110{ id :'tool-todo' , name :'@deepseek-ai/dsh-tool-todo' , config :{ allowParallelInProgress :true } }, 111{ id :'tool-web' , name :'@deepseek-ai/dsh-tool-web' , config :{ fetch :! off . has ( 'fetch' ), search :search && ! off . has ( 'search' ), searchTimeoutMs :60000 } }, 112{ id :'present' , name :'@deepseek-ai/dsh-tool-present' }, 113{ id :'tool-plugin-manager' , name :'@deepseek-ai/dsh-plugin-manager/tools' , disabled :true }, 114]; 115// The groups the person switched off in Settings -> Tools; a web plugin with both halves off is not loaded at all. 116const kept = withoutDisabled ( plugins , off ). filter ( p => p . id !== 'tool-web' || p . config . fetch || p . config . search ); 117return { id :'standard' , order :1 , plugins :kept }; 118}