@kruntime/komputer 0.1.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/README.md +368 -0
- package/dist/agent/approvals.d.ts +28 -0
- package/dist/agent/approvals.js +109 -0
- package/dist/agent/approvals.js.map +1 -0
- package/dist/agent/messages.d.ts +67 -0
- package/dist/agent/messages.js +213 -0
- package/dist/agent/messages.js.map +1 -0
- package/dist/agent/recovery.d.ts +13 -0
- package/dist/agent/recovery.js +112 -0
- package/dist/agent/recovery.js.map +1 -0
- package/dist/agent/session-utils.d.ts +17 -0
- package/dist/agent/session-utils.js +77 -0
- package/dist/agent/session-utils.js.map +1 -0
- package/dist/agent-session.d.ts +303 -0
- package/dist/agent-session.js +3031 -0
- package/dist/agent-session.js.map +1 -0
- package/dist/authority.d.ts +34 -0
- package/dist/authority.js +105 -0
- package/dist/authority.js.map +1 -0
- package/dist/content.d.ts +17 -0
- package/dist/content.js +69 -0
- package/dist/content.js.map +1 -0
- package/dist/cron.d.ts +20 -0
- package/dist/cron.js +25 -0
- package/dist/cron.js.map +1 -0
- package/dist/drive.d.ts +198 -0
- package/dist/drive.js +656 -0
- package/dist/drive.js.map +1 -0
- package/dist/events.d.ts +20 -0
- package/dist/events.js +149 -0
- package/dist/events.js.map +1 -0
- package/dist/fs-mode.d.ts +9 -0
- package/dist/fs-mode.js +98 -0
- package/dist/fs-mode.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/komputer.d.ts +123 -0
- package/dist/komputer.js +733 -0
- package/dist/komputer.js.map +1 -0
- package/dist/kstate.d.ts +107 -0
- package/dist/kstate.js +529 -0
- package/dist/kstate.js.map +1 -0
- package/dist/model.d.ts +81 -0
- package/dist/model.js +824 -0
- package/dist/model.js.map +1 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/dist/path.d.ts +4 -0
- package/dist/path.js +38 -0
- package/dist/path.js.map +1 -0
- package/dist/pool.d.ts +56 -0
- package/dist/pool.js +172 -0
- package/dist/pool.js.map +1 -0
- package/dist/receipts.d.ts +44 -0
- package/dist/receipts.js +35 -0
- package/dist/receipts.js.map +1 -0
- package/dist/remote-node.d.ts +2 -0
- package/dist/remote-node.js +122 -0
- package/dist/remote-node.js.map +1 -0
- package/dist/remote.d.ts +84 -0
- package/dist/remote.js +11 -0
- package/dist/remote.js.map +1 -0
- package/dist/sandbox.d.ts +4 -0
- package/dist/sandbox.js +70 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/shell/builtins/catalog.d.ts +6 -0
- package/dist/shell/builtins/catalog.js +12 -0
- package/dist/shell/builtins/catalog.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/basename.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/basename.js +23 -0
- package/dist/shell/builtins/commands/filesystem/basename.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/cat.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/cat.js +85 -0
- package/dist/shell/builtins/commands/filesystem/cat.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/cd.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/cd.js +14 -0
- package/dist/shell/builtins/commands/filesystem/cd.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/chmod.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/chmod.js +46 -0
- package/dist/shell/builtins/commands/filesystem/chmod.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/copy-directory.d.ts +4 -0
- package/dist/shell/builtins/commands/filesystem/copy-directory.js +48 -0
- package/dist/shell/builtins/commands/filesystem/copy-directory.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/cp.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/cp.js +92 -0
- package/dist/shell/builtins/commands/filesystem/cp.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/dirname.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/dirname.js +23 -0
- package/dist/shell/builtins/commands/filesystem/dirname.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/du.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/du.js +93 -0
- package/dist/shell/builtins/commands/filesystem/du.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/find.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/find.js +111 -0
- package/dist/shell/builtins/commands/filesystem/find.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/install.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/install.js +89 -0
- package/dist/shell/builtins/commands/filesystem/install.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/ln.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/ln.js +57 -0
- package/dist/shell/builtins/commands/filesystem/ln.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/ls.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/ls.js +153 -0
- package/dist/shell/builtins/commands/filesystem/ls.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/mkdir.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/mkdir.js +41 -0
- package/dist/shell/builtins/commands/filesystem/mkdir.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/mktemp.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/mktemp.js +94 -0
- package/dist/shell/builtins/commands/filesystem/mktemp.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/mv.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/mv.js +41 -0
- package/dist/shell/builtins/commands/filesystem/mv.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/pwd.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/pwd.js +2 -0
- package/dist/shell/builtins/commands/filesystem/pwd.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/realpath.d.ts +3 -0
- package/dist/shell/builtins/commands/filesystem/realpath.js +61 -0
- package/dist/shell/builtins/commands/filesystem/realpath.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/rm.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/rm.js +38 -0
- package/dist/shell/builtins/commands/filesystem/rm.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/stat.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/stat.js +141 -0
- package/dist/shell/builtins/commands/filesystem/stat.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem/touch.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem/touch.js +143 -0
- package/dist/shell/builtins/commands/filesystem/touch.js.map +1 -0
- package/dist/shell/builtins/commands/filesystem.d.ts +2 -0
- package/dist/shell/builtins/commands/filesystem.js +44 -0
- package/dist/shell/builtins/commands/filesystem.js.map +1 -0
- package/dist/shell/builtins/commands/network/curl.d.ts +2 -0
- package/dist/shell/builtins/commands/network/curl.js +25 -0
- package/dist/shell/builtins/commands/network/curl.js.map +1 -0
- package/dist/shell/builtins/commands/network/http.d.ts +27 -0
- package/dist/shell/builtins/commands/network/http.js +226 -0
- package/dist/shell/builtins/commands/network/http.js.map +1 -0
- package/dist/shell/builtins/commands/network/wget.d.ts +2 -0
- package/dist/shell/builtins/commands/network/wget.js +32 -0
- package/dist/shell/builtins/commands/network/wget.js.map +1 -0
- package/dist/shell/builtins/commands/network.d.ts +2 -0
- package/dist/shell/builtins/commands/network.js +9 -0
- package/dist/shell/builtins/commands/network.js.map +1 -0
- package/dist/shell/builtins/commands/process/bg.d.ts +2 -0
- package/dist/shell/builtins/commands/process/bg.js +10 -0
- package/dist/shell/builtins/commands/process/bg.js.map +1 -0
- package/dist/shell/builtins/commands/process/fg.d.ts +2 -0
- package/dist/shell/builtins/commands/process/fg.js +14 -0
- package/dist/shell/builtins/commands/process/fg.js.map +1 -0
- package/dist/shell/builtins/commands/process/jobs.d.ts +2 -0
- package/dist/shell/builtins/commands/process/jobs.js +8 -0
- package/dist/shell/builtins/commands/process/jobs.js.map +1 -0
- package/dist/shell/builtins/commands/process/jobspec.d.ts +4 -0
- package/dist/shell/builtins/commands/process/jobspec.js +20 -0
- package/dist/shell/builtins/commands/process/jobspec.js.map +1 -0
- package/dist/shell/builtins/commands/process/kill.d.ts +2 -0
- package/dist/shell/builtins/commands/process/kill.js +35 -0
- package/dist/shell/builtins/commands/process/kill.js.map +1 -0
- package/dist/shell/builtins/commands/process/ps.d.ts +2 -0
- package/dist/shell/builtins/commands/process/ps.js +6 -0
- package/dist/shell/builtins/commands/process/ps.js.map +1 -0
- package/dist/shell/builtins/commands/process/sleep.d.ts +2 -0
- package/dist/shell/builtins/commands/process/sleep.js +6 -0
- package/dist/shell/builtins/commands/process/sleep.js.map +1 -0
- package/dist/shell/builtins/commands/process/wait.d.ts +2 -0
- package/dist/shell/builtins/commands/process/wait.js +21 -0
- package/dist/shell/builtins/commands/process/wait.js.map +1 -0
- package/dist/shell/builtins/commands/process.d.ts +2 -0
- package/dist/shell/builtins/commands/process.js +19 -0
- package/dist/shell/builtins/commands/process.js.map +1 -0
- package/dist/shell/builtins/commands/system/command.d.ts +2 -0
- package/dist/shell/builtins/commands/system/command.js +42 -0
- package/dist/shell/builtins/commands/system/command.js.map +1 -0
- package/dist/shell/builtins/commands/system/date.d.ts +2 -0
- package/dist/shell/builtins/commands/system/date.js +121 -0
- package/dist/shell/builtins/commands/system/date.js.map +1 -0
- package/dist/shell/builtins/commands/system/env.d.ts +2 -0
- package/dist/shell/builtins/commands/system/env.js +84 -0
- package/dist/shell/builtins/commands/system/env.js.map +1 -0
- package/dist/shell/builtins/commands/system/export.d.ts +2 -0
- package/dist/shell/builtins/commands/system/export.js +18 -0
- package/dist/shell/builtins/commands/system/export.js.map +1 -0
- package/dist/shell/builtins/commands/system/false.d.ts +2 -0
- package/dist/shell/builtins/commands/system/false.js +4 -0
- package/dist/shell/builtins/commands/system/false.js.map +1 -0
- package/dist/shell/builtins/commands/system/help.d.ts +2 -0
- package/dist/shell/builtins/commands/system/help.js +38 -0
- package/dist/shell/builtins/commands/system/help.js.map +1 -0
- package/dist/shell/builtins/commands/system/hostname.d.ts +2 -0
- package/dist/shell/builtins/commands/system/hostname.js +6 -0
- package/dist/shell/builtins/commands/system/hostname.js.map +1 -0
- package/dist/shell/builtins/commands/system/id.d.ts +2 -0
- package/dist/shell/builtins/commands/system/id.js +55 -0
- package/dist/shell/builtins/commands/system/id.js.map +1 -0
- package/dist/shell/builtins/commands/system/printenv.d.ts +2 -0
- package/dist/shell/builtins/commands/system/printenv.js +22 -0
- package/dist/shell/builtins/commands/system/printenv.js.map +1 -0
- package/dist/shell/builtins/commands/system/read.d.ts +2 -0
- package/dist/shell/builtins/commands/system/read.js +75 -0
- package/dist/shell/builtins/commands/system/read.js.map +1 -0
- package/dist/shell/builtins/commands/system/resolve-command.d.ts +3 -0
- package/dist/shell/builtins/commands/system/resolve-command.js +34 -0
- package/dist/shell/builtins/commands/system/resolve-command.js.map +1 -0
- package/dist/shell/builtins/commands/system/set.d.ts +2 -0
- package/dist/shell/builtins/commands/system/set.js +49 -0
- package/dist/shell/builtins/commands/system/set.js.map +1 -0
- package/dist/shell/builtins/commands/system/sh.d.ts +2 -0
- package/dist/shell/builtins/commands/system/sh.js +55 -0
- package/dist/shell/builtins/commands/system/sh.js.map +1 -0
- package/dist/shell/builtins/commands/system/source.d.ts +2 -0
- package/dist/shell/builtins/commands/system/source.js +42 -0
- package/dist/shell/builtins/commands/system/source.js.map +1 -0
- package/dist/shell/builtins/commands/system/test-expression.d.ts +2 -0
- package/dist/shell/builtins/commands/system/test-expression.js +93 -0
- package/dist/shell/builtins/commands/system/test-expression.js.map +1 -0
- package/dist/shell/builtins/commands/system/test.d.ts +4 -0
- package/dist/shell/builtins/commands/system/test.js +19 -0
- package/dist/shell/builtins/commands/system/test.js.map +1 -0
- package/dist/shell/builtins/commands/system/true.d.ts +2 -0
- package/dist/shell/builtins/commands/system/true.js +2 -0
- package/dist/shell/builtins/commands/system/true.js.map +1 -0
- package/dist/shell/builtins/commands/system/type.d.ts +2 -0
- package/dist/shell/builtins/commands/system/type.js +77 -0
- package/dist/shell/builtins/commands/system/type.js.map +1 -0
- package/dist/shell/builtins/commands/system/uname.d.ts +2 -0
- package/dist/shell/builtins/commands/system/uname.js +39 -0
- package/dist/shell/builtins/commands/system/uname.js.map +1 -0
- package/dist/shell/builtins/commands/system/unset.d.ts +2 -0
- package/dist/shell/builtins/commands/system/unset.js +9 -0
- package/dist/shell/builtins/commands/system/unset.js.map +1 -0
- package/dist/shell/builtins/commands/system/which.d.ts +2 -0
- package/dist/shell/builtins/commands/system/which.js +38 -0
- package/dist/shell/builtins/commands/system/which.js.map +1 -0
- package/dist/shell/builtins/commands/system/whoami.d.ts +2 -0
- package/dist/shell/builtins/commands/system/whoami.js +6 -0
- package/dist/shell/builtins/commands/system/whoami.js.map +1 -0
- package/dist/shell/builtins/commands/system.d.ts +2 -0
- package/dist/shell/builtins/commands/system.js +49 -0
- package/dist/shell/builtins/commands/system.js.map +1 -0
- package/dist/shell/builtins/commands/text/awk.d.ts +2 -0
- package/dist/shell/builtins/commands/text/awk.js +8 -0
- package/dist/shell/builtins/commands/text/awk.js.map +1 -0
- package/dist/shell/builtins/commands/text/base64.d.ts +2 -0
- package/dist/shell/builtins/commands/text/base64.js +69 -0
- package/dist/shell/builtins/commands/text/base64.js.map +1 -0
- package/dist/shell/builtins/commands/text/cut.d.ts +2 -0
- package/dist/shell/builtins/commands/text/cut.js +35 -0
- package/dist/shell/builtins/commands/text/cut.js.map +1 -0
- package/dist/shell/builtins/commands/text/diff.d.ts +2 -0
- package/dist/shell/builtins/commands/text/diff.js +83 -0
- package/dist/shell/builtins/commands/text/diff.js.map +1 -0
- package/dist/shell/builtins/commands/text/echo.d.ts +2 -0
- package/dist/shell/builtins/commands/text/echo.js +6 -0
- package/dist/shell/builtins/commands/text/echo.js.map +1 -0
- package/dist/shell/builtins/commands/text/grep.d.ts +2 -0
- package/dist/shell/builtins/commands/text/grep.js +123 -0
- package/dist/shell/builtins/commands/text/grep.js.map +1 -0
- package/dist/shell/builtins/commands/text/head.d.ts +2 -0
- package/dist/shell/builtins/commands/text/head.js +8 -0
- package/dist/shell/builtins/commands/text/head.js.map +1 -0
- package/dist/shell/builtins/commands/text/jq.d.ts +2 -0
- package/dist/shell/builtins/commands/text/jq.js +239 -0
- package/dist/shell/builtins/commands/text/jq.js.map +1 -0
- package/dist/shell/builtins/commands/text/printf.d.ts +2 -0
- package/dist/shell/builtins/commands/text/printf.js +3 -0
- package/dist/shell/builtins/commands/text/printf.js.map +1 -0
- package/dist/shell/builtins/commands/text/sed.d.ts +2 -0
- package/dist/shell/builtins/commands/text/sed.js +21 -0
- package/dist/shell/builtins/commands/text/sed.js.map +1 -0
- package/dist/shell/builtins/commands/text/sha256sum.d.ts +2 -0
- package/dist/shell/builtins/commands/text/sha256sum.js +63 -0
- package/dist/shell/builtins/commands/text/sha256sum.js.map +1 -0
- package/dist/shell/builtins/commands/text/sort.d.ts +2 -0
- package/dist/shell/builtins/commands/text/sort.js +134 -0
- package/dist/shell/builtins/commands/text/sort.js.map +1 -0
- package/dist/shell/builtins/commands/text/tail.d.ts +2 -0
- package/dist/shell/builtins/commands/text/tail.js +10 -0
- package/dist/shell/builtins/commands/text/tail.js.map +1 -0
- package/dist/shell/builtins/commands/text/tee.d.ts +2 -0
- package/dist/shell/builtins/commands/text/tee.js +29 -0
- package/dist/shell/builtins/commands/text/tee.js.map +1 -0
- package/dist/shell/builtins/commands/text/tr.d.ts +2 -0
- package/dist/shell/builtins/commands/text/tr.js +3 -0
- package/dist/shell/builtins/commands/text/tr.js.map +1 -0
- package/dist/shell/builtins/commands/text/uniq.d.ts +2 -0
- package/dist/shell/builtins/commands/text/uniq.js +8 -0
- package/dist/shell/builtins/commands/text/uniq.js.map +1 -0
- package/dist/shell/builtins/commands/text/wc.d.ts +2 -0
- package/dist/shell/builtins/commands/text/wc.js +30 -0
- package/dist/shell/builtins/commands/text/wc.js.map +1 -0
- package/dist/shell/builtins/commands/text/xargs.d.ts +2 -0
- package/dist/shell/builtins/commands/text/xargs.js +138 -0
- package/dist/shell/builtins/commands/text/xargs.js.map +1 -0
- package/dist/shell/builtins/commands/text.d.ts +2 -0
- package/dist/shell/builtins/commands/text.js +41 -0
- package/dist/shell/builtins/commands/text.js.map +1 -0
- package/dist/shell/builtins/help-text.d.ts +69 -0
- package/dist/shell/builtins/help-text.js +381 -0
- package/dist/shell/builtins/help-text.js.map +1 -0
- package/dist/shell/builtins/path.d.ts +28 -0
- package/dist/shell/builtins/path.js +184 -0
- package/dist/shell/builtins/path.js.map +1 -0
- package/dist/shell/builtins/registry.d.ts +3 -0
- package/dist/shell/builtins/registry.js +75 -0
- package/dist/shell/builtins/registry.js.map +1 -0
- package/dist/shell/builtins/run.d.ts +4 -0
- package/dist/shell/builtins/run.js +29 -0
- package/dist/shell/builtins/run.js.map +1 -0
- package/dist/shell/builtins/runtime.d.ts +83 -0
- package/dist/shell/builtins/runtime.js +46 -0
- package/dist/shell/builtins/runtime.js.map +1 -0
- package/dist/shell/builtins/text.d.ts +90 -0
- package/dist/shell/builtins/text.js +970 -0
- package/dist/shell/builtins/text.js.map +1 -0
- package/dist/shell/control.d.ts +31 -0
- package/dist/shell/control.js +232 -0
- package/dist/shell/control.js.map +1 -0
- package/dist/shell/expansion.d.ts +30 -0
- package/dist/shell/expansion.js +514 -0
- package/dist/shell/expansion.js.map +1 -0
- package/dist/shell/functions.d.ts +10 -0
- package/dist/shell/functions.js +108 -0
- package/dist/shell/functions.js.map +1 -0
- package/dist/shell/runtime.d.ts +44 -0
- package/dist/shell/runtime.js +276 -0
- package/dist/shell/runtime.js.map +1 -0
- package/dist/shell/time.d.ts +1 -0
- package/dist/shell/time.js +68 -0
- package/dist/shell/time.js.map +1 -0
- package/dist/state-backend.d.ts +61 -0
- package/dist/state-backend.js +275 -0
- package/dist/state-backend.js.map +1 -0
- package/dist/state-node.d.ts +2 -0
- package/dist/state-node.js +266 -0
- package/dist/state-node.js.map +1 -0
- package/dist/types.d.ts +462 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +117 -0
- package/dist/utils.js.map +1 -0
- package/dist/vbash.d.ts +40 -0
- package/dist/vbash.js +389 -0
- package/dist/vbash.js.map +1 -0
- package/dist/vfs.d.ts +64 -0
- package/dist/vfs.js +248 -0
- package/dist/vfs.js.map +1 -0
- package/dist/vprocess.d.ts +139 -0
- package/dist/vprocess.js +756 -0
- package/dist/vprocess.js.map +1 -0
- package/package.json +28 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { normalizeInput } from './content.js';
|
|
2
|
+
import { EventLog } from './events.js';
|
|
3
|
+
import { KFileSystem } from './vfs.js';
|
|
4
|
+
import { VProcessTable } from './vprocess.js';
|
|
5
|
+
import { ShellExpander } from './shell/expansion.js';
|
|
6
|
+
import type { Komputer } from './komputer.js';
|
|
7
|
+
import type { ModeInput } from './authority.js';
|
|
8
|
+
import type { AccessScope, EventEnvelope, HookContext, HookDecision, KMessage, ModeName, ModeState, ModelResult, ModelEvent, RuntimeEvent, RuntimeComputerFace, SessionRecord, TraceRecord, Json } from './types.js';
|
|
9
|
+
import type { KStateLease } from './state-backend.js';
|
|
10
|
+
import type { VJobRecord, VProcessRecord } from './vprocess.js';
|
|
11
|
+
import type { ShellExecutionLimits } from './remote.js';
|
|
12
|
+
import type { ApprovalRecord } from './agent/approvals.js';
|
|
13
|
+
import type { ShellOptions } from './shell/runtime.js';
|
|
14
|
+
export { isFinalTurnEvent } from './agent/session-utils.js';
|
|
15
|
+
type EventHandler = (event: RuntimeEvent, envelope: EventEnvelope) => Promise<void> | void;
|
|
16
|
+
type HookHandler = (ctx: HookContext<Record<string, unknown>>) => Promise<HookDecision | void> | HookDecision | void;
|
|
17
|
+
interface AgentSessionInit {
|
|
18
|
+
computer: Komputer;
|
|
19
|
+
agentName: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
mode?: ModeInput;
|
|
22
|
+
disk?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SendOptions {
|
|
25
|
+
by?: string;
|
|
26
|
+
model?: string;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface ExecOptions {
|
|
30
|
+
by?: string;
|
|
31
|
+
env?: Record<string, string>;
|
|
32
|
+
stdin?: string;
|
|
33
|
+
foreground?: boolean;
|
|
34
|
+
remote?: string;
|
|
35
|
+
limits?: ShellExecutionLimits;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}
|
|
38
|
+
type ExecShellOptions = ExecOptions & {
|
|
39
|
+
forceRemote?: boolean;
|
|
40
|
+
};
|
|
41
|
+
interface TurnEndPayload {
|
|
42
|
+
turnId: string;
|
|
43
|
+
inputId?: string;
|
|
44
|
+
status: string;
|
|
45
|
+
text?: string;
|
|
46
|
+
reason?: string;
|
|
47
|
+
provider?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
export interface ForkOptions {
|
|
50
|
+
from?: string | Record<string, unknown>;
|
|
51
|
+
mode?: ModeInput;
|
|
52
|
+
scope?: AccessScope;
|
|
53
|
+
disk?: string;
|
|
54
|
+
hooks?: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface HookRunResult {
|
|
57
|
+
rejected: boolean;
|
|
58
|
+
current: Record<string, unknown>;
|
|
59
|
+
reason?: string;
|
|
60
|
+
waitingApproval?: boolean;
|
|
61
|
+
approval?: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
export interface UploadOptions {
|
|
64
|
+
by?: string;
|
|
65
|
+
announce?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface DownloadOptions {
|
|
68
|
+
encoding?: 'utf8';
|
|
69
|
+
}
|
|
70
|
+
export interface AgentSessionStats {
|
|
71
|
+
sessionId: string;
|
|
72
|
+
agent: string;
|
|
73
|
+
mode: ModeName;
|
|
74
|
+
disk: string;
|
|
75
|
+
cwd: string;
|
|
76
|
+
closed: boolean;
|
|
77
|
+
localEventHandlers: number;
|
|
78
|
+
localHooks: number;
|
|
79
|
+
localActiveProcesses: number;
|
|
80
|
+
shellFunctions: number;
|
|
81
|
+
}
|
|
82
|
+
export interface AgentSessionInitResult {
|
|
83
|
+
firstLogin: boolean;
|
|
84
|
+
recovered: boolean;
|
|
85
|
+
}
|
|
86
|
+
export declare class AgentSession {
|
|
87
|
+
private readonly runtime;
|
|
88
|
+
computer: RuntimeComputerFace;
|
|
89
|
+
kstate: Komputer['kstate'];
|
|
90
|
+
agentName: string;
|
|
91
|
+
sessionId: string;
|
|
92
|
+
modeState: ModeState;
|
|
93
|
+
mode: ModeName;
|
|
94
|
+
disk: string;
|
|
95
|
+
definition: {
|
|
96
|
+
home?: string;
|
|
97
|
+
model?: string;
|
|
98
|
+
};
|
|
99
|
+
home: string;
|
|
100
|
+
modelAlias: string;
|
|
101
|
+
system: string;
|
|
102
|
+
eventLog: EventLog;
|
|
103
|
+
handlers: Map<string, EventHandler[]>;
|
|
104
|
+
hooks: Map<string, HookHandler[]>;
|
|
105
|
+
shellEnv: Record<string, string>;
|
|
106
|
+
private shellEnvBase?;
|
|
107
|
+
shellFunctions: Record<string, string>;
|
|
108
|
+
shellOptions: ShellOptions;
|
|
109
|
+
private readonly messageLog;
|
|
110
|
+
private readonly approvalLog;
|
|
111
|
+
cwd: string;
|
|
112
|
+
fs: KFileSystem;
|
|
113
|
+
localComputer: RuntimeComputerFace;
|
|
114
|
+
vprocess: VProcessTable;
|
|
115
|
+
shellExpander: ShellExpander;
|
|
116
|
+
turnStopDepth: number;
|
|
117
|
+
maxTurnStopContinuations: number;
|
|
118
|
+
private functionDepth;
|
|
119
|
+
private sourceDepth;
|
|
120
|
+
private fsActorStack;
|
|
121
|
+
lastExitCode: number;
|
|
122
|
+
closed: boolean;
|
|
123
|
+
initResult?: AgentSessionInitResult;
|
|
124
|
+
lease?: KStateLease;
|
|
125
|
+
leaseHeartbeat?: ReturnType<typeof setInterval>;
|
|
126
|
+
constructor({ computer, agentName, sessionId, mode, disk }: AgentSessionInit);
|
|
127
|
+
init(): Promise<this>;
|
|
128
|
+
private reconcileRecoveredProcessReceipts;
|
|
129
|
+
private finalizeProcessReceiptFromWait;
|
|
130
|
+
saveSession(patch: Partial<SessionRecord>): Promise<void>;
|
|
131
|
+
private saveSessionUnchecked;
|
|
132
|
+
startLeaseHeartbeat(): void;
|
|
133
|
+
renewLease(): Promise<void>;
|
|
134
|
+
private assertWritableSession;
|
|
135
|
+
private assertActiveLease;
|
|
136
|
+
private canWriteWithCurrentLease;
|
|
137
|
+
private normalizeModeForAgent;
|
|
138
|
+
ready(): Promise<void>;
|
|
139
|
+
authorizeFs(request: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
140
|
+
trace(type: string, data?: Record<string, unknown>): Promise<TraceRecord>;
|
|
141
|
+
private traceFs;
|
|
142
|
+
private currentFsActor;
|
|
143
|
+
private withFsActor;
|
|
144
|
+
emit(event: RuntimeEvent): Promise<EventEnvelope>;
|
|
145
|
+
events(options?: {
|
|
146
|
+
since?: number;
|
|
147
|
+
types?: RuntimeEvent['type'][];
|
|
148
|
+
signal?: AbortSignal;
|
|
149
|
+
}): AsyncIterable<EventEnvelope>;
|
|
150
|
+
on(type: string, handler: EventHandler): () => void;
|
|
151
|
+
hook(type: string, handler: HookHandler): () => void;
|
|
152
|
+
hasHooks(type: string): boolean;
|
|
153
|
+
runHook(type: string, current: Record<string, unknown>): Promise<HookRunResult>;
|
|
154
|
+
hookContext(type: string, current: Record<string, unknown>): HookContext<Record<string, unknown>>;
|
|
155
|
+
signal(name: string, data?: unknown, options?: {
|
|
156
|
+
level?: string;
|
|
157
|
+
}): Promise<EventEnvelope>;
|
|
158
|
+
emitApprovalRequest(approval: ApprovalRecord): Promise<void>;
|
|
159
|
+
decide(approvalId: string, decision: unknown, options?: {
|
|
160
|
+
by?: string;
|
|
161
|
+
}): Promise<Record<string, unknown>>;
|
|
162
|
+
consumeApproval(approval: ApprovalRecord): Promise<void>;
|
|
163
|
+
resumeApproval(approval: ApprovalRecord): Promise<unknown>;
|
|
164
|
+
resumeFsApproval(current: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
165
|
+
close(): Promise<void>;
|
|
166
|
+
detach(): Promise<void>;
|
|
167
|
+
/** @internal */
|
|
168
|
+
abandonStartup(): Promise<void>;
|
|
169
|
+
private clearRuntimeHandles;
|
|
170
|
+
private releaseLease;
|
|
171
|
+
send(input: Parameters<typeof normalizeInput>[0], options?: SendOptions): Promise<Record<string, unknown>>;
|
|
172
|
+
run(input: Parameters<typeof normalizeInput>[0], options?: SendOptions): Promise<Record<string, unknown>>;
|
|
173
|
+
queue(inputs: Parameters<typeof normalizeInput>[0][], options?: SendOptions): Promise<Record<string, unknown>[]>;
|
|
174
|
+
upload(path: string, data: string | Uint8Array | Json, options?: UploadOptions): Promise<Record<string, unknown>>;
|
|
175
|
+
download(path: string, _options?: DownloadOptions): Promise<{
|
|
176
|
+
path: string;
|
|
177
|
+
text: string;
|
|
178
|
+
bytes: number;
|
|
179
|
+
}>;
|
|
180
|
+
nextTurn({ inputId, model }?: {
|
|
181
|
+
inputId?: string;
|
|
182
|
+
model?: string;
|
|
183
|
+
}): Promise<Record<string, unknown>>;
|
|
184
|
+
consumeModelStream(stream: AsyncIterable<ModelEvent>, { turnId, inputId, emit, }: {
|
|
185
|
+
turnId: string;
|
|
186
|
+
inputId?: string;
|
|
187
|
+
emit: boolean;
|
|
188
|
+
}): Promise<{
|
|
189
|
+
result: ModelResult;
|
|
190
|
+
emitted: boolean;
|
|
191
|
+
}>;
|
|
192
|
+
publishModelResult({ turnId, inputId, model, modelTraceSeq, result, emitContent, }: {
|
|
193
|
+
turnId: string;
|
|
194
|
+
inputId?: string;
|
|
195
|
+
model?: string;
|
|
196
|
+
modelTraceSeq?: number;
|
|
197
|
+
result: ModelResult;
|
|
198
|
+
emitContent?: boolean;
|
|
199
|
+
}): Promise<Record<string, unknown>>;
|
|
200
|
+
endTurn({ turnId, inputId, status, text, reason, provider }: TurnEndPayload): Promise<Record<string, unknown>>;
|
|
201
|
+
recordInput(record: Record<string, unknown>): Promise<void>;
|
|
202
|
+
private nextQueuedInputId;
|
|
203
|
+
stats(): AgentSessionStats;
|
|
204
|
+
exec(command: string, options?: ExecOptions): Promise<Record<string, unknown>>;
|
|
205
|
+
execInternal(command: string, options?: ExecShellOptions): Promise<Record<string, unknown>>;
|
|
206
|
+
execCommand(command: string | {
|
|
207
|
+
command: string;
|
|
208
|
+
argv?: string[];
|
|
209
|
+
stdin?: string;
|
|
210
|
+
remote?: string;
|
|
211
|
+
limits?: ShellExecutionLimits;
|
|
212
|
+
}, options?: ExecOptions): Promise<Record<string, unknown>>;
|
|
213
|
+
private appendExecToolExchange;
|
|
214
|
+
private execShell;
|
|
215
|
+
private remoteShellSandbox;
|
|
216
|
+
private hardenReadonlyMountsForRemoteShell;
|
|
217
|
+
private remoteRealPathsForScope;
|
|
218
|
+
private remoteDenyWritePaths;
|
|
219
|
+
private remoteSandboxPath;
|
|
220
|
+
private requireRealKPath;
|
|
221
|
+
private isKCommandInvocation;
|
|
222
|
+
private isKBuiltinInvocation;
|
|
223
|
+
private isKShellFunctionInvocation;
|
|
224
|
+
private isKLocalSequence;
|
|
225
|
+
private resolveKExecutable;
|
|
226
|
+
private execKLocalSequence;
|
|
227
|
+
private execBackgroundKLocalSequence;
|
|
228
|
+
private execKLocalSegment;
|
|
229
|
+
private execKSubshellFromShell;
|
|
230
|
+
private execKLocalFunctionProgram;
|
|
231
|
+
private execShellReturn;
|
|
232
|
+
private execKLocalControlProgram;
|
|
233
|
+
private execKLocalControl;
|
|
234
|
+
private execKCommandFromShell;
|
|
235
|
+
private execKBuiltinFromShell;
|
|
236
|
+
private execKShellFunctionFromShell;
|
|
237
|
+
private execKExecutableFromShell;
|
|
238
|
+
private failShellCommandBeforeRun;
|
|
239
|
+
private finalizeBackgroundReceipt;
|
|
240
|
+
private trackBackgroundReceipt;
|
|
241
|
+
private runBuiltin;
|
|
242
|
+
private fetchNetwork;
|
|
243
|
+
private applyRedirectedStreams;
|
|
244
|
+
private prepareRedirect;
|
|
245
|
+
private expandRedirectPath;
|
|
246
|
+
private assertRedirectTargetWritable;
|
|
247
|
+
private expandShellArgs;
|
|
248
|
+
private expandCaseToken;
|
|
249
|
+
private expandShellEnv;
|
|
250
|
+
private expandGlobArg;
|
|
251
|
+
private defaultShellEnv;
|
|
252
|
+
private effectiveShellEnv;
|
|
253
|
+
private setShellEnv;
|
|
254
|
+
private unsetShellEnv;
|
|
255
|
+
private setShellOptions;
|
|
256
|
+
private withTemporaryShellState;
|
|
257
|
+
private shellSessionRecord;
|
|
258
|
+
private withTemporaryShellEnvKeys;
|
|
259
|
+
private rememberExit;
|
|
260
|
+
private normalizeShellSegment;
|
|
261
|
+
private withTemporaryMode;
|
|
262
|
+
private emitShellOutput;
|
|
263
|
+
private boundRuntimeEvent;
|
|
264
|
+
private boundShellResult;
|
|
265
|
+
private boundShellReceiptOutput;
|
|
266
|
+
private applyRedirect;
|
|
267
|
+
command(name: string, input?: Record<string, unknown>, options?: SendOptions): Promise<unknown>;
|
|
268
|
+
processes(): Promise<VProcessRecord[]>;
|
|
269
|
+
jobs(): Promise<VJobRecord[]>;
|
|
270
|
+
remoteCwd(): string | undefined;
|
|
271
|
+
hookCwd(): string;
|
|
272
|
+
shellPath(path: string): string;
|
|
273
|
+
appendMessage(message: Omit<KMessage, 'seq' | 'at'>): Promise<KMessage>;
|
|
274
|
+
messagesForModel(): Promise<KMessage[]>;
|
|
275
|
+
get messages(): {
|
|
276
|
+
get: (options?: {}) => Promise<{
|
|
277
|
+
messages: KMessage[];
|
|
278
|
+
cursor: number;
|
|
279
|
+
hasMore: boolean;
|
|
280
|
+
}>;
|
|
281
|
+
current: (options?: {}) => Promise<{
|
|
282
|
+
messages: KMessage[];
|
|
283
|
+
cursor: number;
|
|
284
|
+
hasMore: boolean;
|
|
285
|
+
}>;
|
|
286
|
+
full: (options?: {}) => Promise<{
|
|
287
|
+
messages: KMessage[];
|
|
288
|
+
cursor: number;
|
|
289
|
+
hasMore: boolean;
|
|
290
|
+
}>;
|
|
291
|
+
tail: (options?: {}) => AsyncIterable<{
|
|
292
|
+
cursor: number;
|
|
293
|
+
message: KMessage;
|
|
294
|
+
}>;
|
|
295
|
+
};
|
|
296
|
+
checkpoint({ label }?: {
|
|
297
|
+
label?: string;
|
|
298
|
+
}): Promise<Record<string, unknown>>;
|
|
299
|
+
fork({ from, mode, scope, disk, hooks }?: ForkOptions): Promise<AgentSession>;
|
|
300
|
+
sealUnfinishedTools(): Promise<number>;
|
|
301
|
+
sealUnfinishedToolEvents(): Promise<number>;
|
|
302
|
+
sealInterruptedTurns(): Promise<number>;
|
|
303
|
+
}
|