@kruntime/komputer 0.1.1 → 0.1.3
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/agent-session.js +192 -7
- package/dist/agent-session.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/komputer.js +29 -2
- package/dist/komputer.js.map +1 -1
- package/dist/shell/builtins/commands/filesystem.js +22 -20
- package/dist/shell/builtins/commands/filesystem.js.map +1 -1
- package/dist/shell/builtins/commands/network.js +3 -2
- package/dist/shell/builtins/commands/network.js.map +1 -1
- package/dist/shell/builtins/commands/process.js +9 -7
- package/dist/shell/builtins/commands/process.js.map +1 -1
- package/dist/shell/builtins/commands/system.js +27 -24
- package/dist/shell/builtins/commands/system.js.map +1 -1
- package/dist/shell/builtins/commands/text.js +20 -18
- package/dist/shell/builtins/commands/text.js.map +1 -1
- package/dist/shell/builtins/run.d.ts +9 -1
- package/dist/shell/builtins/run.js +12 -0
- package/dist/shell/builtins/run.js.map +1 -1
- package/dist/shell/builtins/runtime.d.ts +6 -2
- package/dist/shell/builtins/runtime.js +10 -3
- package/dist/shell/builtins/runtime.js.map +1 -1
- package/dist/types.d.ts +33 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -116,6 +116,10 @@ export interface RuntimeContext {
|
|
|
116
116
|
name?: string;
|
|
117
117
|
input?: Record<string, unknown>;
|
|
118
118
|
args: Record<string, unknown>;
|
|
119
|
+
argv: string[];
|
|
120
|
+
stdin: string;
|
|
121
|
+
env: Record<string, string>;
|
|
122
|
+
cwd: string;
|
|
119
123
|
computer: RuntimeComputerFace;
|
|
120
124
|
agent: AgentSession;
|
|
121
125
|
exec(command: string | ExecInput, options?: ExecOptions): Promise<Record<string, unknown>>;
|
|
@@ -138,6 +142,16 @@ export interface RuntimeContext {
|
|
|
138
142
|
text: string;
|
|
139
143
|
code: number;
|
|
140
144
|
};
|
|
145
|
+
text(text: string, code?: number): {
|
|
146
|
+
type: 'stdout';
|
|
147
|
+
text: string;
|
|
148
|
+
code?: number;
|
|
149
|
+
};
|
|
150
|
+
exit(code?: number): {
|
|
151
|
+
stdout: string;
|
|
152
|
+
stderr: string;
|
|
153
|
+
code: number;
|
|
154
|
+
};
|
|
141
155
|
result(output: {
|
|
142
156
|
stdout?: string;
|
|
143
157
|
stderr?: string;
|
|
@@ -156,6 +170,19 @@ export interface RuntimeContext {
|
|
|
156
170
|
level?: string;
|
|
157
171
|
}): Promise<EventEnvelope>;
|
|
158
172
|
}
|
|
173
|
+
export type RuntimeCommandArgType = 'string' | 'number' | 'boolean' | 'json' | 'path';
|
|
174
|
+
export interface RuntimeCommandArgSpec {
|
|
175
|
+
type: RuntimeCommandArgType;
|
|
176
|
+
required?: boolean;
|
|
177
|
+
default?: unknown;
|
|
178
|
+
defaultValue?: unknown;
|
|
179
|
+
description?: string;
|
|
180
|
+
choices?: unknown[];
|
|
181
|
+
repeat?: boolean;
|
|
182
|
+
position?: number;
|
|
183
|
+
flag?: string;
|
|
184
|
+
}
|
|
185
|
+
export type RuntimeCommandArgs = 'none' | 'argv' | Record<string, RuntimeCommandArgSpec>;
|
|
159
186
|
export interface RuntimeCommand {
|
|
160
187
|
name?: string;
|
|
161
188
|
kind?: 'module' | 'shell' | 'markdown';
|
|
@@ -165,11 +192,17 @@ export interface RuntimeCommand {
|
|
|
165
192
|
script?: string;
|
|
166
193
|
prompt?: string;
|
|
167
194
|
help?: string;
|
|
195
|
+
args?: RuntimeCommandArgs;
|
|
196
|
+
readonly?: boolean;
|
|
197
|
+
parallelSafe?: boolean;
|
|
198
|
+
timeout?: string;
|
|
168
199
|
model?: string;
|
|
169
200
|
command?: string;
|
|
170
201
|
remote?: string;
|
|
171
202
|
limits?: ShellExecutionLimits;
|
|
172
203
|
argv?: string[] | ((input: Record<string, unknown>) => string[]);
|
|
204
|
+
main?: (ctx: RuntimeContext, input?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
205
|
+
/** @deprecated Use main(ctx) for new command declarations. */
|
|
173
206
|
handler?: (ctx: RuntimeContext, input?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
174
207
|
[key: string]: unknown;
|
|
175
208
|
}
|
package/package.json
CHANGED