@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/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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kruntime/komputer",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "Production TypeScript SDK/runtime for K Komputer, AgentSession, KState, authority, events, receipts, and recovery.",
6
6
  "exports": {