@kvman/kvcoder 0.1.5 → 0.1.7
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/api.d.ts +49 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/calls/run-shell.d.ts.map +1 -1
- package/dist/calls/run-shell.js +39 -9
- package/dist/calls/run-shell.js.map +1 -1
- package/dist/connector-call.d.ts +1 -1
- package/dist/connector-call.d.ts.map +1 -1
- package/dist/connector-call.js +4 -2
- package/dist/connector-call.js.map +1 -1
- package/dist/connectors/artifact.d.ts +1 -1
- package/dist/connectors/artifact.d.ts.map +1 -1
- package/dist/connectors/artifact.js +4 -4
- package/dist/connectors/artifact.js.map +1 -1
- package/dist/connectors/ask.d.ts +24 -0
- package/dist/connectors/ask.d.ts.map +1 -1
- package/dist/connectors/ask.js +20 -11
- package/dist/connectors/ask.js.map +1 -1
- package/dist/connectors/background.d.ts +14 -1
- package/dist/connectors/background.d.ts.map +1 -1
- package/dist/connectors/background.js +53 -23
- package/dist/connectors/background.js.map +1 -1
- package/dist/connectors/builtin-connectors.d.ts +111 -0
- package/dist/connectors/builtin-connectors.d.ts.map +1 -1
- package/dist/connectors/builtin-connectors.js +4 -1
- package/dist/connectors/builtin-connectors.js.map +1 -1
- package/dist/connectors/delegate.d.ts +9 -3
- package/dist/connectors/delegate.d.ts.map +1 -1
- package/dist/connectors/delegate.js +29 -10
- package/dist/connectors/delegate.js.map +1 -1
- package/dist/connectors/execution-map.d.ts +62 -0
- package/dist/connectors/execution-map.d.ts.map +1 -0
- package/dist/connectors/execution-map.js +142 -0
- package/dist/connectors/execution-map.js.map +1 -0
- package/dist/connectors/fs.d.ts +32 -1
- package/dist/connectors/fs.d.ts.map +1 -1
- package/dist/connectors/fs.js +76 -45
- package/dist/connectors/fs.js.map +1 -1
- package/dist/connectors/mcp.d.ts +18 -1
- package/dist/connectors/mcp.d.ts.map +1 -1
- package/dist/connectors/mcp.js +54 -6
- package/dist/connectors/mcp.js.map +1 -1
- package/dist/connectors/payload-fields.d.ts.map +1 -1
- package/dist/connectors/payload-fields.js +1 -1
- package/dist/connectors/payload-fields.js.map +1 -1
- package/dist/delegate/approved-run.d.ts +4 -6
- package/dist/delegate/approved-run.d.ts.map +1 -1
- package/dist/delegate/approved-run.js +74 -34
- package/dist/delegate/approved-run.js.map +1 -1
- package/dist/delegate/git-staging.d.ts +12 -0
- package/dist/delegate/git-staging.d.ts.map +1 -0
- package/dist/delegate/git-staging.js +54 -0
- package/dist/delegate/git-staging.js.map +1 -0
- package/dist/delegate/permission.d.ts +240 -0
- package/dist/delegate/permission.d.ts.map +1 -0
- package/dist/delegate/permission.js +78 -0
- package/dist/delegate/permission.js.map +1 -0
- package/dist/delegate/program-permission.d.ts +27 -0
- package/dist/delegate/program-permission.d.ts.map +1 -0
- package/dist/delegate/program-permission.js +53 -0
- package/dist/delegate/program-permission.js.map +1 -0
- package/dist/delegate/register-worker-run.d.ts.map +1 -1
- package/dist/delegate/register-worker-run.js +27 -11
- package/dist/delegate/register-worker-run.js.map +1 -1
- package/dist/delegate/run-program.d.ts.map +1 -1
- package/dist/delegate/run-program.js +29 -8
- package/dist/delegate/run-program.js.map +1 -1
- package/dist/delegate/runs.d.ts +14 -4
- package/dist/delegate/runs.d.ts.map +1 -1
- package/dist/delegate/runs.js +49 -19
- package/dist/delegate/runs.js.map +1 -1
- package/dist/delegate/staging-guard.d.ts +9 -0
- package/dist/delegate/staging-guard.d.ts.map +1 -0
- package/dist/delegate/staging-guard.js +55 -0
- package/dist/delegate/staging-guard.js.map +1 -0
- package/dist/delegate/start-background.d.ts +7 -0
- package/dist/delegate/start-background.d.ts.map +1 -0
- package/dist/delegate/start-background.js +32 -0
- package/dist/delegate/start-background.js.map +1 -0
- package/dist/delegate/start-pending.d.ts +5 -0
- package/dist/delegate/start-pending.d.ts.map +1 -0
- package/dist/delegate/start-pending.js +42 -0
- package/dist/delegate/start-pending.js.map +1 -0
- package/dist/delegate/workers.d.ts +5 -2
- package/dist/delegate/workers.d.ts.map +1 -1
- package/dist/delegate/workers.js +44 -8
- package/dist/delegate/workers.js.map +1 -1
- package/dist/files/file-change.d.ts +28 -0
- package/dist/files/file-change.d.ts.map +1 -0
- package/dist/files/file-change.js +125 -0
- package/dist/files/file-change.js.map +1 -0
- package/dist/files/file-parts.d.ts +18 -0
- package/dist/files/file-parts.d.ts.map +1 -0
- package/dist/files/file-parts.js +40 -0
- package/dist/files/file-parts.js.map +1 -0
- package/dist/files/read-file.d.ts +9 -1
- package/dist/files/read-file.d.ts.map +1 -1
- package/dist/files/read-file.js +35 -13
- package/dist/files/read-file.js.map +1 -1
- package/dist/files/search-text.d.ts +12 -2
- package/dist/files/search-text.d.ts.map +1 -1
- package/dist/files/search-text.js +87 -23
- package/dist/files/search-text.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs/job-rows.d.ts +11 -2
- package/dist/jobs/job-rows.d.ts.map +1 -1
- package/dist/jobs/job-rows.js +25 -14
- package/dist/jobs/job-rows.js.map +1 -1
- package/dist/jobs/process-handlers.d.ts.map +1 -1
- package/dist/jobs/process-handlers.js +12 -1
- package/dist/jobs/process-handlers.js.map +1 -1
- package/dist/jobs/process-report.d.ts.map +1 -1
- package/dist/jobs/process-report.js +2 -1
- package/dist/jobs/process-report.js.map +1 -1
- package/dist/jobs/process-run.d.ts.map +1 -1
- package/dist/jobs/process-run.js +2 -1
- package/dist/jobs/process-run.js.map +1 -1
- package/dist/jobs/register-jobs.d.ts.map +1 -1
- package/dist/jobs/register-jobs.js +1 -0
- package/dist/jobs/register-jobs.js.map +1 -1
- package/dist/maps/map-reminder.d.ts +7 -0
- package/dist/maps/map-reminder.d.ts.map +1 -0
- package/dist/maps/map-reminder.js +24 -0
- package/dist/maps/map-reminder.js.map +1 -0
- package/dist/maps/map-rules.d.ts +36 -0
- package/dist/maps/map-rules.d.ts.map +1 -0
- package/dist/maps/map-rules.js +86 -0
- package/dist/maps/map-rules.js.map +1 -0
- package/dist/maps/map-schema.d.ts +55 -0
- package/dist/maps/map-schema.d.ts.map +1 -0
- package/dist/maps/map-schema.js +27 -0
- package/dist/maps/map-schema.js.map +1 -0
- package/dist/maps/register-maps.d.ts +3 -0
- package/dist/maps/register-maps.d.ts.map +1 -0
- package/dist/maps/register-maps.js +21 -0
- package/dist/maps/register-maps.js.map +1 -0
- package/dist/mcp/connect.d.ts +2 -0
- package/dist/mcp/connect.d.ts.map +1 -1
- package/dist/mcp/connect.js +16 -4
- package/dist/mcp/connect.js.map +1 -1
- package/dist/mcp/oauth-provider.d.ts +8 -5
- package/dist/mcp/oauth-provider.d.ts.map +1 -1
- package/dist/mcp/oauth-provider.js +31 -22
- package/dist/mcp/oauth-provider.js.map +1 -1
- package/dist/mcp/secrets.d.ts +2 -0
- package/dist/mcp/secrets.d.ts.map +1 -1
- package/dist/mcp/secrets.js +6 -0
- package/dist/mcp/secrets.js.map +1 -1
- package/dist/mcp/sign-in.d.ts.map +1 -1
- package/dist/mcp/sign-in.js +12 -4
- package/dist/mcp/sign-in.js.map +1 -1
- package/dist/messages/receive-message.d.ts +2 -1
- package/dist/messages/receive-message.d.ts.map +1 -1
- package/dist/messages/receive-message.js +34 -9
- package/dist/messages/receive-message.js.map +1 -1
- package/dist/messages/register-messages.d.ts.map +1 -1
- package/dist/messages/register-messages.js +13 -8
- package/dist/messages/register-messages.js.map +1 -1
- package/dist/messages/send-receipt.d.ts +10 -0
- package/dist/messages/send-receipt.d.ts.map +1 -0
- package/dist/messages/send-receipt.js +14 -0
- package/dist/messages/send-receipt.js.map +1 -0
- package/dist/prompt/build-prompt.d.ts +1 -0
- package/dist/prompt/build-prompt.d.ts.map +1 -1
- package/dist/prompt/build-prompt.js +5 -1
- package/dist/prompt/build-prompt.js.map +1 -1
- package/dist/prompt/project-rules.d.ts +6 -0
- package/dist/prompt/project-rules.d.ts.map +1 -0
- package/dist/prompt/project-rules.js +37 -0
- package/dist/prompt/project-rules.js.map +1 -0
- package/dist/prompt/session-grants.d.ts +209 -0
- package/dist/prompt/session-grants.d.ts.map +1 -0
- package/dist/prompt/session-grants.js +50 -0
- package/dist/prompt/session-grants.js.map +1 -0
- package/dist/prompt/session-prompt.d.ts +3 -2
- package/dist/prompt/session-prompt.d.ts.map +1 -1
- package/dist/prompt/session-prompt.js +24 -40
- package/dist/prompt/session-prompt.js.map +1 -1
- package/dist/prompt/working-method.d.ts.map +1 -1
- package/dist/prompt/working-method.js +22 -16
- package/dist/prompt/working-method.js.map +1 -1
- package/dist/register-settings.d.ts +3 -1
- package/dist/register-settings.d.ts.map +1 -1
- package/dist/register-settings.js +5 -4
- package/dist/register-settings.js.map +1 -1
- package/dist/registry/register-connectors.d.ts +9 -0
- package/dist/registry/register-connectors.d.ts.map +1 -1
- package/dist/registry/register-connectors.js +20 -12
- package/dist/registry/register-connectors.js.map +1 -1
- package/dist/result-text.d.ts +4 -0
- package/dist/result-text.d.ts.map +1 -1
- package/dist/result-text.js +9 -0
- package/dist/result-text.js.map +1 -1
- package/dist/schemas/records.d.ts +142 -0
- package/dist/schemas/records.d.ts.map +1 -1
- package/dist/schemas/records.js +60 -2
- package/dist/schemas/records.js.map +1 -1
- package/dist/sessions/execution-root.d.ts +8 -0
- package/dist/sessions/execution-root.d.ts.map +1 -0
- package/dist/sessions/execution-root.js +25 -0
- package/dist/sessions/execution-root.js.map +1 -0
- package/dist/sessions/new-session.d.ts +5 -1
- package/dist/sessions/new-session.d.ts.map +1 -1
- package/dist/sessions/new-session.js +17 -4
- package/dist/sessions/new-session.js.map +1 -1
- package/dist/sessions/register-context.d.ts.map +1 -1
- package/dist/sessions/register-context.js +6 -5
- package/dist/sessions/register-context.js.map +1 -1
- package/dist/sessions/register-fork-export.d.ts.map +1 -1
- package/dist/sessions/register-fork-export.js +5 -3
- package/dist/sessions/register-fork-export.js.map +1 -1
- package/dist/sessions/register-lifecycle.d.ts.map +1 -1
- package/dist/sessions/register-lifecycle.js +14 -5
- package/dist/sessions/register-lifecycle.js.map +1 -1
- package/dist/sessions/register-sessions.d.ts.map +1 -1
- package/dist/sessions/register-sessions.js +0 -2
- package/dist/sessions/register-sessions.js.map +1 -1
- package/dist/sessions/session-view.d.ts +23 -0
- package/dist/sessions/session-view.d.ts.map +1 -1
- package/dist/sessions/session-view.js +4 -1
- package/dist/sessions/session-view.js.map +1 -1
- package/dist/store/all-docs.d.ts +4 -0
- package/dist/store/all-docs.d.ts.map +1 -0
- package/dist/store/all-docs.js +14 -0
- package/dist/store/all-docs.js.map +1 -0
- package/dist/store/collections.d.ts +230 -0
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/collections.js +16 -1
- package/dist/store/collections.js.map +1 -1
- package/dist/turns/answer-fingerprint.d.ts +4 -0
- package/dist/turns/answer-fingerprint.d.ts.map +1 -0
- package/dist/turns/answer-fingerprint.js +18 -0
- package/dist/turns/answer-fingerprint.js.map +1 -0
- package/dist/turns/apply-answer.d.ts +19 -0
- package/dist/turns/apply-answer.d.ts.map +1 -0
- package/dist/turns/apply-answer.js +47 -0
- package/dist/turns/apply-answer.js.map +1 -0
- package/dist/turns/background.d.ts +3 -0
- package/dist/turns/background.d.ts.map +1 -1
- package/dist/turns/background.js +13 -12
- package/dist/turns/background.js.map +1 -1
- package/dist/turns/call-groups.d.ts +9 -0
- package/dist/turns/call-groups.d.ts.map +1 -0
- package/dist/turns/call-groups.js +18 -0
- package/dist/turns/call-groups.js.map +1 -0
- package/dist/turns/call-permission.d.ts +22 -0
- package/dist/turns/call-permission.d.ts.map +1 -0
- package/dist/turns/call-permission.js +49 -0
- package/dist/turns/call-permission.js.map +1 -0
- package/dist/turns/cancel-step-job.d.ts +14 -0
- package/dist/turns/cancel-step-job.d.ts.map +1 -0
- package/dist/turns/cancel-step-job.js +35 -0
- package/dist/turns/cancel-step-job.js.map +1 -0
- package/dist/turns/child-result.d.ts +7 -0
- package/dist/turns/child-result.d.ts.map +1 -0
- package/dist/turns/child-result.js +24 -0
- package/dist/turns/child-result.js.map +1 -0
- package/dist/turns/compaction.d.ts +15 -1
- package/dist/turns/compaction.d.ts.map +1 -1
- package/dist/turns/compaction.js +48 -18
- package/dist/turns/compaction.js.map +1 -1
- package/dist/turns/end-turn-state.d.ts +42 -0
- package/dist/turns/end-turn-state.d.ts.map +1 -0
- package/dist/turns/end-turn-state.js +64 -0
- package/dist/turns/end-turn-state.js.map +1 -0
- package/dist/turns/end-turn.d.ts +7 -8
- package/dist/turns/end-turn.d.ts.map +1 -1
- package/dist/turns/end-turn.js +52 -55
- package/dist/turns/end-turn.js.map +1 -1
- package/dist/turns/helper-calls.d.ts +6 -0
- package/dist/turns/helper-calls.d.ts.map +1 -0
- package/dist/turns/helper-calls.js +8 -0
- package/dist/turns/helper-calls.js.map +1 -0
- package/dist/turns/history.d.ts +3 -1
- package/dist/turns/history.d.ts.map +1 -1
- package/dist/turns/history.js +15 -7
- package/dist/turns/history.js.map +1 -1
- package/dist/turns/lost-reply.d.ts +7 -0
- package/dist/turns/lost-reply.d.ts.map +1 -1
- package/dist/turns/lost-reply.js +12 -0
- package/dist/turns/lost-reply.js.map +1 -1
- package/dist/turns/message-blocks.d.ts +2 -0
- package/dist/turns/message-blocks.d.ts.map +1 -1
- package/dist/turns/message-blocks.js +7 -0
- package/dist/turns/message-blocks.js.map +1 -1
- package/dist/turns/model-context.d.ts +2 -0
- package/dist/turns/model-context.d.ts.map +1 -1
- package/dist/turns/model-context.js +29 -5
- package/dist/turns/model-context.js.map +1 -1
- package/dist/turns/model-retry.d.ts +2 -1
- package/dist/turns/model-retry.d.ts.map +1 -1
- package/dist/turns/model-retry.js +5 -1
- package/dist/turns/model-retry.js.map +1 -1
- package/dist/turns/read-only.d.ts +6 -0
- package/dist/turns/read-only.d.ts.map +1 -0
- package/dist/turns/read-only.js +12 -0
- package/dist/turns/read-only.js.map +1 -0
- package/dist/turns/receipt-job.d.ts +5 -0
- package/dist/turns/receipt-job.d.ts.map +1 -0
- package/dist/turns/receipt-job.js +40 -0
- package/dist/turns/receipt-job.js.map +1 -0
- package/dist/turns/recover-workspace.d.ts +9 -0
- package/dist/turns/recover-workspace.d.ts.map +1 -0
- package/dist/turns/recover-workspace.js +79 -0
- package/dist/turns/recover-workspace.js.map +1 -0
- package/dist/turns/recovery-state.d.ts +19 -0
- package/dist/turns/recovery-state.d.ts.map +1 -0
- package/dist/turns/recovery-state.js +87 -0
- package/dist/turns/recovery-state.js.map +1 -0
- package/dist/turns/register-interruptions.d.ts.map +1 -1
- package/dist/turns/register-interruptions.js +19 -8
- package/dist/turns/register-interruptions.js.map +1 -1
- package/dist/turns/register-turns.d.ts.map +1 -1
- package/dist/turns/register-turns.js +42 -31
- package/dist/turns/register-turns.js.map +1 -1
- package/dist/turns/resolve.d.ts +4 -0
- package/dist/turns/resolve.d.ts.map +1 -1
- package/dist/turns/resolve.js +19 -17
- package/dist/turns/resolve.js.map +1 -1
- package/dist/turns/retry-turn.d.ts +4 -0
- package/dist/turns/retry-turn.d.ts.map +1 -0
- package/dist/turns/retry-turn.js +20 -0
- package/dist/turns/retry-turn.js.map +1 -0
- package/dist/turns/run-calls.d.ts +21 -4
- package/dist/turns/run-calls.d.ts.map +1 -1
- package/dist/turns/run-calls.js +157 -41
- package/dist/turns/run-calls.js.map +1 -1
- package/dist/turns/run-command.d.ts +5 -3
- package/dist/turns/run-command.d.ts.map +1 -1
- package/dist/turns/run-command.js +21 -12
- package/dist/turns/run-command.js.map +1 -1
- package/dist/turns/settle-calls.d.ts +2 -8
- package/dist/turns/settle-calls.d.ts.map +1 -1
- package/dist/turns/settle-calls.js +26 -35
- package/dist/turns/settle-calls.js.map +1 -1
- package/dist/turns/start-turn.d.ts +8 -83
- package/dist/turns/start-turn.d.ts.map +1 -1
- package/dist/turns/start-turn.js +35 -24
- package/dist/turns/start-turn.js.map +1 -1
- package/dist/turns/step-claim.d.ts +39 -0
- package/dist/turns/step-claim.d.ts.map +1 -0
- package/dist/turns/step-claim.js +72 -0
- package/dist/turns/step-claim.js.map +1 -0
- package/dist/turns/step-intents.d.ts +31 -0
- package/dist/turns/step-intents.d.ts.map +1 -0
- package/dist/turns/step-intents.js +101 -0
- package/dist/turns/step-intents.js.map +1 -0
- package/dist/turns/step-next.d.ts +17 -0
- package/dist/turns/step-next.d.ts.map +1 -0
- package/dist/turns/step-next.js +25 -0
- package/dist/turns/step-next.js.map +1 -0
- package/dist/turns/step.d.ts +1 -1
- package/dist/turns/step.d.ts.map +1 -1
- package/dist/turns/step.js +108 -88
- package/dist/turns/step.js.map +1 -1
- package/dist/turns/summary-facts.d.ts +25 -0
- package/dist/turns/summary-facts.d.ts.map +1 -0
- package/dist/turns/summary-facts.js +63 -0
- package/dist/turns/summary-facts.js.map +1 -0
- package/dist/turns/usage.d.ts +7 -0
- package/dist/turns/usage.d.ts.map +1 -0
- package/dist/turns/usage.js +18 -0
- package/dist/turns/usage.js.map +1 -0
- package/dist/ui/register-ui.js +3 -3
- package/dist/ui/register-ui.js.map +1 -1
- package/dist/web/components/approval.css +2 -0
- package/dist/web/components/approval.js +233 -0
- package/dist/web/components/call.css +1 -1
- package/dist/web/components/call.js +841 -131
- package/dist/web/components/connectors.css +1 -1
- package/dist/web/components/connectors.js +595 -592
- package/dist/web/components/conversation.css +1 -1
- package/dist/web/components/conversation.js +3341 -1418
- package/dist/web/components/mcp-sign-in.css +1 -1
- package/dist/web/components/model.css +1 -1
- package/dist/web/components/model.js +138 -134
- package/dist/web/components/question.css +1 -1
- package/dist/web/components/question.js +148 -78
- package/dist/web/components/sessions.css +1 -1
- package/docs/connectors.md +2 -2
- package/locales/ar.json +119 -12
- package/locales/en.json +119 -12
- package/package.json +6 -6
- package/dist/turns/cancel-turn.d.ts +0 -3
- package/dist/turns/cancel-turn.d.ts.map +0 -1
- package/dist/turns/cancel-turn.js +0 -31
- package/dist/turns/cancel-turn.js.map +0 -1
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
import { z } from '@kvman/sdk';
|
|
2
|
+
import { delay } from "../delay.js";
|
|
2
3
|
import { cancelJob, jobDetail, jobRows } from "../jobs/job-rows.js";
|
|
3
4
|
import { callInput } from "./connector-command.js";
|
|
4
5
|
// The `background` connector (plan 08 §8.5, ADR 0011, 6): what this chat started with `background: true`, a process or
|
|
5
|
-
// a subagent, listed, read, or stopped by the id the starting call returned. The agent sees no kernel job.
|
|
6
|
+
// a subagent, listed, read, waited for, or stopped by the id the starting call returned. The agent sees no kernel job.
|
|
6
7
|
/** What the prompt's index says the connector is for. */
|
|
7
|
-
export const backgroundDescription = 'Follow up on what you started with background set to true: a server or other long-running shell line, or a background subagent. Use it to see its status or output, or to stop it.';
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
export const backgroundDescription = 'Follow up on what you started with background set to true: a server or other long-running shell line, or a background subagent. Use it to see its status or output, to wait for it to end, or to stop it. When you need a run\'s result before you can go on, call wait once: asking for its output again and again fills the conversation, and a run that ends tells you in a message anyway.';
|
|
9
|
+
const id = z.string().min(1).describe('The id that the call which started the work returned.');
|
|
10
|
+
const started = z.strictObject({ id });
|
|
11
|
+
/** How long `wait` waits when the call names no time, the most it waits, and how often it looks. */
|
|
12
|
+
export const waitDefaultMs = 120_000;
|
|
13
|
+
export const waitLimitMs = 600_000;
|
|
14
|
+
const lookEveryMs = 500;
|
|
15
|
+
const titleShown = 80;
|
|
16
|
+
const payloads = {
|
|
17
|
+
list: z.strictObject({}),
|
|
18
|
+
output: z.strictObject({ id, lines: z.number().int().min(1).max(500).describe("How many of a process's last lines to return: 100 by default, 500 at most.").exactOptional() }),
|
|
19
|
+
wait: z.strictObject({ id, timeoutMs: z.number().int().min(1000).max(waitLimitMs).describe('The most to wait, in milliseconds: 120000 by default, 600000 at most.').exactOptional() }),
|
|
20
|
+
stop: started,
|
|
21
|
+
};
|
|
10
22
|
export const backgroundCommands = {
|
|
11
|
-
list: { registration: 'kvcoder.background.list', description: "Lists this chat's newest 50 background runs, newest first.", payload: payloads.list, asks: false },
|
|
12
|
-
output: { registration: 'kvcoder.background.output.get', description: "Gives one background run's status, and its output (a process's last
|
|
23
|
+
list: { registration: 'kvcoder.background.list', description: "Lists this chat's newest 50 background runs, newest first, each with its id, kind, title, and status.", payload: payloads.list, asks: false },
|
|
24
|
+
output: { registration: 'kvcoder.background.output.get', description: "Gives one background run's status, and its output (a process's last lines, a subagent's answer, or what a program worker's run returned).", payload: payloads.output, asks: false },
|
|
25
|
+
wait: { registration: 'kvcoder.background.wait', description: 'Waits until a background run ends or the time passes, then gives its status and output as output does.', payload: payloads.wait, asks: false },
|
|
13
26
|
stop: { registration: 'kvcoder.background.stop', description: "Stops a background process or a program worker's run, or cancels a background subagent.", payload: payloads.stop, asks: false },
|
|
14
27
|
};
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const found = await jobDetail(ctx, sessionId, id);
|
|
28
|
+
const times = { status: z.string(), startedAt: z.string(), endedAt: z.string().exactOptional(), exitCode: z.number().int().exactOptional() };
|
|
29
|
+
const kind = z.enum(['process', 'subagent', 'worker']);
|
|
30
|
+
const rowSchema = z.object({ id: z.string(), kind, call: z.string(), ...times });
|
|
31
|
+
const shortRowSchema = z.object({ id: z.string(), kind, title: z.string(), ...times });
|
|
32
|
+
const detailSchema = rowSchema.extend({ output: z.json().exactOptional(), problem: z.json().exactOptional() });
|
|
33
|
+
const ended = (row) => ({ ...(row.endedAt === undefined ? {} : { endedAt: row.endedAt }), ...(row.exitCode === undefined ? {} : { exitCode: row.exitCode }) });
|
|
34
|
+
const forAgent = (row) => ({ id: row.id, kind: row.kind, call: row.call, status: row.status, startedAt: row.startedAt, ...ended(row) });
|
|
35
|
+
// A list names each run in a few words (ADR 0068, 2): the whole line or task is in `output`.
|
|
36
|
+
const shortRow = (row) => ({ id: row.id, kind: row.kind, title: row.title.length > titleShown ? `${row.title.slice(0, titleShown - 1)}…` : row.title, status: row.status, startedAt: row.startedAt, ...ended(row) });
|
|
37
|
+
async function startedBy(ctx, sessionId, runId, lines) {
|
|
38
|
+
const found = await jobDetail(ctx, sessionId, runId, lines);
|
|
27
39
|
if (found === undefined)
|
|
28
|
-
throw ctx.problem('kvcoder/JOB_NOT_FOUND', { sessionId, id });
|
|
40
|
+
throw ctx.problem('kvcoder/JOB_NOT_FOUND', { sessionId, id: runId });
|
|
29
41
|
return found;
|
|
30
42
|
}
|
|
31
43
|
const commands = backgroundCommands;
|
|
@@ -33,15 +45,33 @@ export function registerBackgroundConnector(ctx) {
|
|
|
33
45
|
ctx.registerQuery('kvcoder.background.list', {
|
|
34
46
|
description: commands.list.description,
|
|
35
47
|
input: callInput(payloads.list),
|
|
36
|
-
output: z.array(
|
|
37
|
-
handle: async ({ sessionId }) => (await jobRows(ctx, sessionId)).map(
|
|
48
|
+
output: z.array(shortRowSchema),
|
|
49
|
+
handle: async ({ sessionId }) => (await jobRows(ctx, sessionId)).map(shortRow),
|
|
38
50
|
});
|
|
39
51
|
ctx.registerQuery('kvcoder.background.output.get', {
|
|
40
52
|
description: commands.output.description,
|
|
41
53
|
input: callInput(payloads.output),
|
|
42
|
-
output:
|
|
54
|
+
output: detailSchema,
|
|
55
|
+
handle: async ({ sessionId, payload }) => {
|
|
56
|
+
const found = await startedBy(ctx, sessionId, payload.id, payload.lines);
|
|
57
|
+
return { ...forAgent(found.row), ...found.detail };
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
// A run is looked at until it has ended (ADR 0068, 1), as a line in the shell waits on its process: the wait is this job's own.
|
|
61
|
+
ctx.registerCommand('kvcoder.background.wait', {
|
|
62
|
+
description: commands.wait.description,
|
|
63
|
+
input: callInput(payloads.wait),
|
|
64
|
+
output: detailSchema,
|
|
65
|
+
retries: 0,
|
|
66
|
+
timeoutMs: waitLimitMs + 60_000,
|
|
43
67
|
handle: async ({ sessionId, payload }) => {
|
|
44
|
-
const
|
|
68
|
+
const until = Date.now() + (payload.timeoutMs ?? waitDefaultMs);
|
|
69
|
+
let found = await startedBy(ctx, sessionId, payload.id);
|
|
70
|
+
while (found.row.status === 'running' && Date.now() < until) {
|
|
71
|
+
await delay(Math.min(lookEveryMs, until - Date.now()), ctx.job.signal);
|
|
72
|
+
ctx.job.signal.throwIfAborted();
|
|
73
|
+
found = await startedBy(ctx, sessionId, payload.id);
|
|
74
|
+
}
|
|
45
75
|
return { ...forAgent(found.row), ...found.detail };
|
|
46
76
|
},
|
|
47
77
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background.js","sourceRoot":"","sources":["../../src/connectors/background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAY,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAe,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAyB,MAAM,wBAAwB,CAAC;AAE1E,uHAAuH;AACvH,
|
|
1
|
+
{"version":3,"file":"background.js","sourceRoot":"","sources":["../../src/connectors/background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAY,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAe,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAyB,MAAM,wBAAwB,CAAC;AAE1E,uHAAuH;AACvH,uHAAuH;AAEvH,yDAAyD;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAChC,gYAAgY,CAAC;AAEnY,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uDAAuD,CAAC,CAAC;AAC/F,MAAM,OAAO,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAEvC,oGAAoG;AACp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MAAM,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC,MAAM,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC;KACrJ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -22,6 +22,7 @@ export declare const builtinCommands: {
|
|
|
22
22
|
payload: import("zod").ZodObject<{
|
|
23
23
|
path: import("zod").ZodString;
|
|
24
24
|
fromLine: import("zod").ZodExactOptional<import("zod").ZodNumber>;
|
|
25
|
+
fromColumn: import("zod").ZodExactOptional<import("zod").ZodNumber>;
|
|
25
26
|
lines: import("zod").ZodExactOptional<import("zod").ZodNumber>;
|
|
26
27
|
}, import("zod/v4/core").$strict>;
|
|
27
28
|
asks: false;
|
|
@@ -42,6 +43,8 @@ export declare const builtinCommands: {
|
|
|
42
43
|
payload: import("zod").ZodObject<{
|
|
43
44
|
pattern: import("zod").ZodString;
|
|
44
45
|
path: import("zod").ZodExactOptional<import("zod").ZodString>;
|
|
46
|
+
literal: import("zod").ZodExactOptional<import("zod").ZodBoolean>;
|
|
47
|
+
glob: import("zod").ZodExactOptional<import("zod").ZodString>;
|
|
45
48
|
}, import("zod/v4/core").$strict>;
|
|
46
49
|
asks: false;
|
|
47
50
|
bounded: true;
|
|
@@ -69,6 +72,34 @@ export declare const builtinCommands: {
|
|
|
69
72
|
}, import("zod/v4/core").$strict>;
|
|
70
73
|
asks: true;
|
|
71
74
|
};
|
|
75
|
+
undo: {
|
|
76
|
+
registration: string;
|
|
77
|
+
description: string;
|
|
78
|
+
payload: import("zod").ZodObject<{
|
|
79
|
+
path: import("zod").ZodString;
|
|
80
|
+
risky: import("zod").ZodBoolean;
|
|
81
|
+
}, import("zod/v4/core").$strict>;
|
|
82
|
+
asks: true;
|
|
83
|
+
};
|
|
84
|
+
part: {
|
|
85
|
+
registration: string;
|
|
86
|
+
description: string;
|
|
87
|
+
payload: import("zod").ZodObject<{
|
|
88
|
+
path: import("zod").ZodString;
|
|
89
|
+
part: import("zod").ZodNumber;
|
|
90
|
+
content: import("zod").ZodString;
|
|
91
|
+
}, import("zod/v4/core").$strict>;
|
|
92
|
+
asks: false;
|
|
93
|
+
};
|
|
94
|
+
assemble: {
|
|
95
|
+
registration: string;
|
|
96
|
+
description: string;
|
|
97
|
+
payload: import("zod").ZodObject<{
|
|
98
|
+
path: import("zod").ZodString;
|
|
99
|
+
risky: import("zod").ZodBoolean;
|
|
100
|
+
}, import("zod/v4/core").$strict>;
|
|
101
|
+
asks: true;
|
|
102
|
+
};
|
|
72
103
|
};
|
|
73
104
|
artifact: {
|
|
74
105
|
write: {
|
|
@@ -108,6 +139,60 @@ export declare const builtinCommands: {
|
|
|
108
139
|
asks: false;
|
|
109
140
|
};
|
|
110
141
|
};
|
|
142
|
+
'execution-map': {
|
|
143
|
+
set: {
|
|
144
|
+
registration: string;
|
|
145
|
+
description: string;
|
|
146
|
+
payload: import("zod").ZodObject<{
|
|
147
|
+
goal: import("zod").ZodString;
|
|
148
|
+
steps: import("zod").ZodArray<import("zod").ZodObject<{
|
|
149
|
+
id: import("zod").ZodString;
|
|
150
|
+
title: import("zod").ZodString;
|
|
151
|
+
description: import("zod").ZodString;
|
|
152
|
+
after: import("zod").ZodExactOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
153
|
+
uses: import("zod").ZodExactOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
|
|
154
|
+
check: import("zod").ZodString;
|
|
155
|
+
}, import("zod/v4/core").$strict>>;
|
|
156
|
+
}, import("zod/v4/core").$strict>;
|
|
157
|
+
asks: false;
|
|
158
|
+
result: string;
|
|
159
|
+
};
|
|
160
|
+
update: {
|
|
161
|
+
registration: string;
|
|
162
|
+
description: string;
|
|
163
|
+
payload: import("zod").ZodObject<{
|
|
164
|
+
steps: import("zod").ZodArray<import("zod").ZodObject<{
|
|
165
|
+
id: import("zod").ZodString;
|
|
166
|
+
status: import("zod").ZodEnum<{
|
|
167
|
+
done: "done";
|
|
168
|
+
failed: "failed";
|
|
169
|
+
todo: "todo";
|
|
170
|
+
doing: "doing";
|
|
171
|
+
skipped: "skipped";
|
|
172
|
+
}>;
|
|
173
|
+
evidence: import("zod").ZodExactOptional<import("zod").ZodString>;
|
|
174
|
+
note: import("zod").ZodExactOptional<import("zod").ZodString>;
|
|
175
|
+
}, import("zod/v4/core").$strict>>;
|
|
176
|
+
}, import("zod/v4/core").$strict>;
|
|
177
|
+
asks: false;
|
|
178
|
+
result: string;
|
|
179
|
+
};
|
|
180
|
+
note: {
|
|
181
|
+
registration: string;
|
|
182
|
+
description: string;
|
|
183
|
+
payload: import("zod").ZodObject<{
|
|
184
|
+
text: import("zod").ZodString;
|
|
185
|
+
}, import("zod/v4/core").$strict>;
|
|
186
|
+
asks: false;
|
|
187
|
+
result: string;
|
|
188
|
+
};
|
|
189
|
+
get: {
|
|
190
|
+
registration: string;
|
|
191
|
+
description: string;
|
|
192
|
+
payload: import("zod").ZodObject<{}, import("zod/v4/core").$strict>;
|
|
193
|
+
asks: false;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
111
196
|
background: {
|
|
112
197
|
list: {
|
|
113
198
|
registration: string;
|
|
@@ -120,6 +205,16 @@ export declare const builtinCommands: {
|
|
|
120
205
|
description: string;
|
|
121
206
|
payload: import("zod").ZodObject<{
|
|
122
207
|
id: import("zod").ZodString;
|
|
208
|
+
lines: import("zod").ZodExactOptional<import("zod").ZodNumber>;
|
|
209
|
+
}, import("zod/v4/core").$strict>;
|
|
210
|
+
asks: false;
|
|
211
|
+
};
|
|
212
|
+
wait: {
|
|
213
|
+
registration: string;
|
|
214
|
+
description: string;
|
|
215
|
+
payload: import("zod").ZodObject<{
|
|
216
|
+
id: import("zod").ZodString;
|
|
217
|
+
timeoutMs: import("zod").ZodExactOptional<import("zod").ZodNumber>;
|
|
123
218
|
}, import("zod/v4/core").$strict>;
|
|
124
219
|
asks: false;
|
|
125
220
|
};
|
|
@@ -176,6 +271,7 @@ export declare const builtinCommands: {
|
|
|
176
271
|
description: string;
|
|
177
272
|
payload: import("zod").ZodObject<{
|
|
178
273
|
worker: import("zod").ZodString;
|
|
274
|
+
title: import("zod").ZodString;
|
|
179
275
|
task: import("zod").ZodString;
|
|
180
276
|
background: import("zod").ZodExactOptional<import("zod").ZodBoolean>;
|
|
181
277
|
}, import("zod/v4/core").$strict>;
|
|
@@ -206,6 +302,21 @@ export declare const builtinCommands: {
|
|
|
206
302
|
asks: true;
|
|
207
303
|
result: string;
|
|
208
304
|
};
|
|
305
|
+
run: {
|
|
306
|
+
registration: string;
|
|
307
|
+
description: string;
|
|
308
|
+
payload: import("zod").ZodObject<{
|
|
309
|
+
server: import("zod").ZodString;
|
|
310
|
+
steps: import("zod").ZodArray<import("zod").ZodObject<{
|
|
311
|
+
tool: import("zod").ZodString;
|
|
312
|
+
arguments: import("zod").ZodExactOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodJSONSchema>>;
|
|
313
|
+
}, import("zod/v4/core").$strict>>;
|
|
314
|
+
timeoutMs: import("zod").ZodExactOptional<import("zod").ZodNumber>;
|
|
315
|
+
risky: import("zod").ZodBoolean;
|
|
316
|
+
}, import("zod/v4/core").$strict>;
|
|
317
|
+
asks: true;
|
|
318
|
+
result: string;
|
|
319
|
+
};
|
|
209
320
|
};
|
|
210
321
|
};
|
|
211
322
|
/** A built-in connector's commands by name, in the order `help` lists them. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-connectors.d.ts","sourceRoot":"","sources":["../../src/connectors/builtin-connectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI/E,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin-connectors.d.ts","sourceRoot":"","sources":["../../src/connectors/builtin-connectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI/E,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAUlF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAS0C,CAAC;AAEvE,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,SAAS,EAAE,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAElG;AAED,8HAA8H;AAC9H,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAElG;AAYD,wGAAwG;AACxG,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CASzE,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { askCommands, askDescription } from "./ask.js";
|
|
|
4
4
|
import { backgroundCommands, backgroundDescription } from "./background.js";
|
|
5
5
|
import { payloadJsonSchema } from "./connector-command.js";
|
|
6
6
|
import { delegateCommands, delegateDescription } from "./delegate.js";
|
|
7
|
+
import { executionMapCommands, executionMapDescription } from "./execution-map.js";
|
|
7
8
|
import { fsCommands, fsDescription } from "./fs.js";
|
|
8
9
|
import { mcpCommands, mcpDescription } from "./mcp.js";
|
|
9
10
|
import { shellCommands, shellDescription } from "./shell.js";
|
|
@@ -13,6 +14,7 @@ export const builtinCommands = {
|
|
|
13
14
|
shell: shellCommands,
|
|
14
15
|
fs: fsCommands,
|
|
15
16
|
artifact: artifactCommands,
|
|
17
|
+
'execution-map': executionMapCommands,
|
|
16
18
|
background: backgroundCommands,
|
|
17
19
|
ask: askCommands,
|
|
18
20
|
delegate: delegateCommands,
|
|
@@ -24,7 +26,7 @@ export function commandsOf(connector) {
|
|
|
24
26
|
}
|
|
25
27
|
/** What the prompt's connector index and `help` say each built-in connector is for; `shell` names the shell this run uses. */
|
|
26
28
|
export function builtinDescriptions(shell) {
|
|
27
|
-
return { shell: shellDescription(shell), fs: fsDescription, artifact: artifactDescription, background: backgroundDescription, ask: askDescription, delegate: delegateDescription, mcp: mcpDescription };
|
|
29
|
+
return { shell: shellDescription(shell), fs: fsDescription, artifact: artifactDescription, 'execution-map': executionMapDescription, background: backgroundDescription, ask: askDescription, delegate: delegateDescription, mcp: mcpDescription };
|
|
28
30
|
}
|
|
29
31
|
// Each built-in payload is an object, so a missing signature is a programming error, not a case the prompt may fall
|
|
30
32
|
// back from; computed once per worker, not at every prompt build. In the order of `commandsOf`, like the prompt's lines.
|
|
@@ -41,6 +43,7 @@ export const builtinSignatures = {
|
|
|
41
43
|
shell: signaturesOf('shell'),
|
|
42
44
|
fs: signaturesOf('fs'),
|
|
43
45
|
artifact: signaturesOf('artifact'),
|
|
46
|
+
'execution-map': signaturesOf('execution-map'),
|
|
44
47
|
background: signaturesOf('background'),
|
|
45
48
|
ask: signaturesOf('ask'),
|
|
46
49
|
delegate: signaturesOf('delegate'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-connectors.js","sourceRoot":"","sources":["../../src/connectors/builtin-connectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM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EAAE,GAAG,EAAE,cAAc,EAAE,CAAC;AACpP,CAAC;AAED,oHAAoH;AACpH,yHAAyH;AACzH,SAAS,YAAY,CAAC,SAA2B;IAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC1D,MAAM,SAAS,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACvE,IAAI,SAAS,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,SAAS,4BAA4B,CAAC,CAAC;QACxG,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,wGAAwG;AACxG,MAAM,CAAC,MAAM,iBAAiB,GAAgD;IAC5E,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC;IAC5B,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC;IACtB,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC;IAClC,eAAe,EAAE,YAAY,CAAC,eAAe,CAAC;IAC9C,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC;IACtC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC;IACxB,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC;IAClC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC;CACzB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z, type Ctx, type Stored } from '@kvman/sdk';
|
|
2
2
|
import { type SubagentWorker, type Worker } from '../delegate/workers.ts';
|
|
3
|
+
import type { CreationGuard } from '../delegate/permission.ts';
|
|
3
4
|
import type { SessionDoc } from '../schemas/records.ts';
|
|
4
5
|
/** What the prompt's index says the connector is for; the session's entry adds its workers. */
|
|
5
6
|
export declare const delegateDescription = "Hand a self-contained task to a worker: a helper agent that works on it alone and returns its answer. Use it for a specialist view or to do a separate part in parallel, or with background set to true while you go on.";
|
|
@@ -7,6 +8,7 @@ export declare const delegateDescription = "Hand a self-contained task to a work
|
|
|
7
8
|
export declare function delegateIndexDescription(workers: readonly Worker[]): string;
|
|
8
9
|
export declare const delegateRunSchema: z.ZodObject<{
|
|
9
10
|
worker: z.ZodString;
|
|
11
|
+
title: z.ZodString;
|
|
10
12
|
task: z.ZodString;
|
|
11
13
|
background: z.ZodExactOptional<z.ZodBoolean>;
|
|
12
14
|
}, z.core.$strict>;
|
|
@@ -16,6 +18,7 @@ export declare const delegateCommands: {
|
|
|
16
18
|
description: string;
|
|
17
19
|
payload: z.ZodObject<{
|
|
18
20
|
worker: z.ZodString;
|
|
21
|
+
title: z.ZodString;
|
|
19
22
|
task: z.ZodString;
|
|
20
23
|
background: z.ZodExactOptional<z.ZodBoolean>;
|
|
21
24
|
}, z.core.$strict>;
|
|
@@ -25,8 +28,11 @@ export declare const delegateCommands: {
|
|
|
25
28
|
};
|
|
26
29
|
export type DelegateRun = z.output<typeof delegateRunSchema>;
|
|
27
30
|
export declare function registerDelegateConnector(ctx: Ctx): void;
|
|
28
|
-
/** Creates the worker's child session, with the task as its first message. */
|
|
29
|
-
export declare function createChild(ctx: Ctx, parent: Stored<SessionDoc>, worker: SubagentWorker,
|
|
31
|
+
/** Creates the worker's child session, named by the run's title (ADR 0037, 2), with the task as its first message. */
|
|
32
|
+
export declare function createChild(ctx: Ctx, parent: Stored<SessionDoc>, worker: SubagentWorker, run: {
|
|
33
|
+
title: string;
|
|
34
|
+
task: string;
|
|
35
|
+
}, guard: CreationGuard): Promise<string>;
|
|
30
36
|
/** Starts the child's turn and tells the parent's stream, so the conversation can stream the child (ADR 0009, 99). */
|
|
31
|
-
export declare function startChild(ctx: Ctx, childId: string): Promise<void>;
|
|
37
|
+
export declare function startChild(ctx: Ctx, childId: string, guard: CreationGuard): Promise<void>;
|
|
32
38
|
//# sourceMappingURL=delegate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../../src/connectors/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"delegate.d.ts","sourceRoot":"","sources":["../../src/connectors/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAI3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAYxD,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,6NAC4L,CAAC;AAE7N,4GAA4G;AAC5G,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAE3E;AAOD,eAAO,MAAM,iBAAiB;;;;;kBAK5B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAEe,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7D,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAYxD;AAED,sHAAsH;AACtH,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAqC3K;AAED,sHAAsH;AACtH,wBAAsB,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAW/F"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from '@kvman/sdk';
|
|
2
2
|
import { availableWorker } from "../delegate/workers.js";
|
|
3
3
|
import { firePoint } from "../registry/session-points.js";
|
|
4
|
+
import { invalid } from "../problems.js";
|
|
5
|
+
import { settingSchemas } from "../register-settings.js";
|
|
4
6
|
import { now } from "../sessions/session-lookup.js";
|
|
5
7
|
import { records, txRecords } from "../store/collections.js";
|
|
6
8
|
import { appendMessage, noUsage, userContent } from "../turns/history.js";
|
|
@@ -16,8 +18,12 @@ export const delegateDescription = 'Hand a self-contained task to a worker: a he
|
|
|
16
18
|
export function delegateIndexDescription(workers) {
|
|
17
19
|
return `${delegateDescription} Workers: ${workers.map((worker) => `${worker.name} (${worker.description.replace(/[.\s]+$/, '')})`).join(', ')}.`;
|
|
18
20
|
}
|
|
21
|
+
const titleShown = 60;
|
|
22
|
+
// A helper's name as the person sees it: a title over 60 characters keeps its first 59 and an ellipsis (ADR 0051, 4).
|
|
23
|
+
const shownTitle = (title) => (title.length > titleShown ? `${title.slice(0, titleShown - 1)}…` : title);
|
|
19
24
|
export const delegateRunSchema = z.strictObject({
|
|
20
25
|
worker: z.string().min(1).describe('The worker to hand the task to, by a name the system prompt lists.'),
|
|
26
|
+
title: z.string().min(1).max(200).describe("The role this run plays, in a few words, such as UI expert or Node.js expert: the person sees it as the helper's name. Keep it under 60 characters; a longer one is shortened."),
|
|
21
27
|
task: z.string().min(1).describe("The worker's whole brief: the goal, the facts it needs, its limits, and what to return."),
|
|
22
28
|
background: z.boolean().describe('true lets you go on at once; the answer arrives later as a message.').exactOptional(),
|
|
23
29
|
});
|
|
@@ -37,24 +43,33 @@ export function registerDelegateConnector(ctx) {
|
|
|
37
43
|
},
|
|
38
44
|
});
|
|
39
45
|
}
|
|
40
|
-
/** Creates the worker's child session, with the task as its first message. */
|
|
41
|
-
export async function createChild(ctx, parent, worker,
|
|
46
|
+
/** Creates the worker's child session, named by the run's title (ADR 0037, 2), with the task as its first message. */
|
|
47
|
+
export async function createChild(ctx, parent, worker, run, guard) {
|
|
48
|
+
// A worker that names no model uses the one set for helpers, and the chat's own when none is (ADR 0069, 3).
|
|
49
|
+
const helperModel = settingSchemas.model.parse(await ctx.settings.get('kvcoder.delegate.model'));
|
|
42
50
|
const childId = await ctx.store.transaction((tx) => {
|
|
43
51
|
const store = txRecords(tx);
|
|
52
|
+
const canonical = guard(store);
|
|
53
|
+
if (canonical.id !== parent.id)
|
|
54
|
+
throw invalid('Delegation requires its originating session.');
|
|
44
55
|
const stamp = now();
|
|
45
56
|
const child = store.sessions.insert({
|
|
46
|
-
title:
|
|
57
|
+
title: shownTitle(run.title),
|
|
47
58
|
autoTitle: false,
|
|
59
|
+
deleting: false,
|
|
48
60
|
status: 'idle',
|
|
49
61
|
parentId: parent.id,
|
|
50
|
-
worker: { name: worker.name, instructions: worker.instructions },
|
|
51
|
-
model: worker.model ??
|
|
52
|
-
thinking: worker.thinking ??
|
|
62
|
+
worker: { name: worker.name, instructions: worker.instructions, readOnly: worker.readOnly },
|
|
63
|
+
model: worker.model ?? helperModel ?? canonical.model,
|
|
64
|
+
thinking: worker.thinking ?? canonical.thinking,
|
|
53
65
|
stepJobId: null,
|
|
66
|
+
stepGeneration: 0,
|
|
67
|
+
stepIntentId: null,
|
|
54
68
|
turnId: null,
|
|
55
69
|
endedTurns: 0,
|
|
56
70
|
nextSeq: 0,
|
|
57
71
|
usage: noUsage(),
|
|
72
|
+
usageBy: { summary: noUsage(), title: noUsage(), helpers: noUsage() },
|
|
58
73
|
durationMs: 0,
|
|
59
74
|
checks: null,
|
|
60
75
|
connectors: worker.connectors,
|
|
@@ -62,22 +77,26 @@ export async function createChild(ctx, parent, worker, task) {
|
|
|
62
77
|
createdAt: stamp,
|
|
63
78
|
updatedAt: stamp,
|
|
64
79
|
});
|
|
65
|
-
appendMessage(store, child, { kind: 'user', content: userContent(task), source: { kind: 'subagent', sessionId: parent.id } });
|
|
80
|
+
appendMessage(store, child, { kind: 'user', content: userContent(run.task), source: { kind: 'subagent', sessionId: parent.id } });
|
|
66
81
|
return child.id;
|
|
67
82
|
});
|
|
68
83
|
await firePoint(ctx, 'kvcoder.session.created', { sessionId: childId, parentId: parent.id });
|
|
69
84
|
return childId;
|
|
70
85
|
}
|
|
71
86
|
/** Starts the child's turn and tells the parent's stream, so the conversation can stream the child (ADR 0009, 99). */
|
|
72
|
-
export async function startChild(ctx, childId) {
|
|
87
|
+
export async function startChild(ctx, childId, guard) {
|
|
73
88
|
const turnId = await ctx.store.transaction((tx) => {
|
|
74
89
|
const store = txRecords(tx);
|
|
90
|
+
const parent = guard(store);
|
|
75
91
|
const child = store.sessions.get(childId);
|
|
76
|
-
|
|
92
|
+
if (child !== undefined && child.parentId !== parent.id)
|
|
93
|
+
throw invalid('The child no longer belongs to its originating session.');
|
|
94
|
+
return child === undefined || child.status !== 'idle' || child.turnId !== null || child.endedTurns !== 0 ? undefined : openTurn(store, child);
|
|
77
95
|
});
|
|
78
96
|
if (turnId === undefined)
|
|
79
97
|
return;
|
|
80
98
|
const jobId = await beginTurn(ctx, childId, turnId, false);
|
|
81
|
-
|
|
99
|
+
if (jobId !== null)
|
|
100
|
+
ctx.job.progress({ type: 'subagent', sessionId: childId, jobId });
|
|
82
101
|
}
|
|
83
102
|
//# sourceMappingURL=delegate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../src/connectors/delegate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAyB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,eAAe,EAAoC,MAAM,wBAAwB,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version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AAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE;YAAE,MAAM,OAAO,CAAC,yDAAyD,CAAC,CAAC;QAClI,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChJ,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO;IACjC,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3D,IAAI,KAAK,KAAK,IAAI;QAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z, type Ctx } from '@kvman/sdk';
|
|
2
|
+
/** What the prompt's index says the connector is for. */
|
|
3
|
+
export declare const executionMapDescription = "Plan work of several steps as the execution map: your execution path, the steps you found to be the best and fastest way to deliver the request with the connectors and workers you have, and the implementation plan the person reads, agrees to, and watches as a diagram. Keep it true as you work: the person follows the work on it. A step says what it changes and how in its description, which the person opens with a press, names who does it in uses, and comes after the steps it follows. Steps side by side are branches: each is handed to a worker, so they run at the same time, and your own steps are one line. Mark a step doing when you start it and done with your evidence as soon as its check passed, and record a problem the work does not need with note instead of looking into it.";
|
|
4
|
+
/** The steps one map holds at most, and its notes. */
|
|
5
|
+
export declare const stepsLimit = 40;
|
|
6
|
+
export declare const notesLimit = 50;
|
|
7
|
+
export declare const executionMapCommands: {
|
|
8
|
+
set: {
|
|
9
|
+
registration: string;
|
|
10
|
+
description: string;
|
|
11
|
+
payload: z.ZodObject<{
|
|
12
|
+
goal: z.ZodString;
|
|
13
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
title: z.ZodString;
|
|
16
|
+
description: z.ZodString;
|
|
17
|
+
after: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
|
|
18
|
+
uses: z.ZodExactOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
19
|
+
check: z.ZodString;
|
|
20
|
+
}, z.core.$strict>>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
asks: false;
|
|
23
|
+
result: string;
|
|
24
|
+
};
|
|
25
|
+
update: {
|
|
26
|
+
registration: string;
|
|
27
|
+
description: string;
|
|
28
|
+
payload: z.ZodObject<{
|
|
29
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
status: z.ZodEnum<{
|
|
32
|
+
done: "done";
|
|
33
|
+
failed: "failed";
|
|
34
|
+
todo: "todo";
|
|
35
|
+
doing: "doing";
|
|
36
|
+
skipped: "skipped";
|
|
37
|
+
}>;
|
|
38
|
+
evidence: z.ZodExactOptional<z.ZodString>;
|
|
39
|
+
note: z.ZodExactOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
asks: false;
|
|
43
|
+
result: string;
|
|
44
|
+
};
|
|
45
|
+
note: {
|
|
46
|
+
registration: string;
|
|
47
|
+
description: string;
|
|
48
|
+
payload: z.ZodObject<{
|
|
49
|
+
text: z.ZodString;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
asks: false;
|
|
52
|
+
result: string;
|
|
53
|
+
};
|
|
54
|
+
get: {
|
|
55
|
+
registration: string;
|
|
56
|
+
description: string;
|
|
57
|
+
payload: z.ZodObject<{}, z.core.$strict>;
|
|
58
|
+
asks: false;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export declare function registerExecutionMapConnector(ctx: Ctx): void;
|
|
62
|
+
//# sourceMappingURL=execution-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-map.d.ts","sourceRoot":"","sources":["../../src/connectors/execution-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAczC,yDAAyD;AACzD,eAAO,MAAM,uBAAuB,uxBACkvB,CAAC;AAEvxB,sDAAsD;AACtD,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,UAAU,KAAK,CAAC;AA+C7B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKW,CAAC;AAqB7C,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CA8D5D"}
|