@agimon-ai/po-codemode 0.0.1-alpha.2 → 0.0.1-alpha.4

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.
@@ -1,9 +1,13 @@
1
- import { n as createCodemodeRegistry, t as createCodemodeTools } from "../codemodeTools-BdwOARH8.mjs";
1
+ import { n as createCodemodeRegistry, t as createCodemodeTools } from "../codemodeTools-D7CcAB18.mjs";
2
2
  import { PO_CODEMODE_CONTRACT, PO_CODEMODE_SERVICE } from "@agimon-ai/po-core/codemode";
3
+ import { Type } from "typebox";
3
4
  import { PO_SERVER_SCOPE_SERVICE, composeServerProviderOverrides, defineServerPlugin, packageResourcePath, readPackageResource, requirePoServerScope } from "@agimon-ai/po-core/serverPlugin";
4
5
  import { composeRootHooks, composeRootInjects, defineResource, defineRoot, defineServerTool, defineServiceContract } from "@agimon-ai/po-core/extensionFile";
5
- import { BACKGROUND_CONTEXT, PO_SESSION_FILES_SERVICE, getOrThrow, readPoFs, readPoIsolate } from "@agimon-ai/po-core/platform";
6
- import { PO_HELP_WHEN } from "@agimon-ai/po-core/help";
6
+ import { PO_CONFIG_SERVICE } from "@agimon-ai/po-config";
7
+ import { BACKGROUND_CONTEXT, PO_SESSION_FILES_SERVICE, PO_SHELL_SERVICE, getOrThrow, readPoFs, readPoIsolate, readPoNpm, withAbortSignal } from "@agimon-ai/po-core/platform";
8
+ import { readMajorModesConfig, readPackageConfigurations } from "@agimon-ai/po-config/majorModes";
9
+ import { Check } from "typebox/value";
10
+ import { Check as Check$1, Errors, Meta } from "typebox/schema";
7
11
  //#region src/services/codemodeScripts/index.ts
8
12
  const SESSION_FOLDER = "codemode";
9
13
  const SESSION_PREFIX = "session:";
@@ -113,9 +117,377 @@ var FileSystemCodemodeScriptsService = class {
113
117
  }
114
118
  };
115
119
  //#endregion
120
+ //#region src/schemas/packageConfig.ts
121
+ const CODEMODE_PACKAGE = "@agimon-ai/po-codemode";
122
+ const CodemodePackageConfigSchema = Type.Object({ llmModel: Type.Optional(Type.String({
123
+ pattern: "^[^/\\s]+/\\S+$",
124
+ maxLength: 256
125
+ })) }, { additionalProperties: false });
126
+ //#endregion
127
+ //#region src/services/llmConfig/index.ts
128
+ const PO_CODEMODE_LLM_CONFIG_SERVICE = "po/codemode-llm-config";
129
+ /** Session policy is loaded once per immutable Po config snapshot, including failed loads. */
130
+ var LlmConfigService = class {
131
+ io;
132
+ snapshot;
133
+ loads = /* @__PURE__ */ new WeakMap();
134
+ constructor(io) {
135
+ this.io = io;
136
+ }
137
+ bind(snapshot) {
138
+ this.snapshot = snapshot;
139
+ return () => {
140
+ if (this.snapshot === snapshot) this.snapshot = void 0;
141
+ };
142
+ }
143
+ current() {
144
+ if (!this.snapshot) return Promise.resolve({});
145
+ const snapshot = this.snapshot();
146
+ let load = this.loads.get(snapshot);
147
+ if (!load) {
148
+ load = this.load(snapshot);
149
+ this.loads.set(snapshot, load);
150
+ }
151
+ return load;
152
+ }
153
+ async load(snapshot) {
154
+ if (!snapshot.harness.root) return {};
155
+ const { environment, homeDirectory } = this.io;
156
+ const fs = this.io.fs();
157
+ if (!fs || !homeDirectory) throw new Error("Code mode LLM configuration requires host filesystem and home.");
158
+ const modes = await readMajorModesConfig(fs, snapshot.harness.root, BACKGROUND_CONTEXT, {
159
+ environment,
160
+ homeDirectory
161
+ });
162
+ const configurations = await readPackageConfigurations(fs, modes, [...snapshot.harness.layers], CODEMODE_PACKAGE, BACKGROUND_CONTEXT);
163
+ let merged = {};
164
+ for (const entry of configurations) {
165
+ if (!Check(CodemodePackageConfigSchema, entry.config)) throw new TypeError("Invalid code mode package configuration: llmModel must be provider/modelId.");
166
+ merged = {
167
+ ...merged,
168
+ ...entry.config
169
+ };
170
+ }
171
+ return merged;
172
+ }
173
+ };
174
+ //#endregion
175
+ //#region src/services/llmNamespace/index.ts
176
+ const MAX_INPUT_BYTES = 65536;
177
+ const MAX_SCHEMA_BYTES = 16384;
178
+ const MAX_OUTPUT_BYTES = 65536;
179
+ const MAX_CALLS = 8;
180
+ const MAX_CONCURRENT = 2;
181
+ const DEFAULT_TOKENS = 1024;
182
+ const MAX_TOKENS = 4096;
183
+ const RESULT_TOOL = "return_result";
184
+ const MODEL = /^[^/\s]+\/\S+$/u;
185
+ const META = Meta["http://json-schema.org/draft-07/schema#"];
186
+ const DECLARATIONS$1 = `interface LlmRequest {
187
+ prompt: string;
188
+ /** Explicit JSON input only, never the surrounding conversation. */
189
+ input?: unknown;
190
+ system?: string;
191
+ /** provider/modelId; overrides llmModel config and the live session model. */
192
+ model?: string;
193
+ /** Defaults to 1024, maximum 4096. */
194
+ maxTokens?: number;
195
+ }
196
+ declare const llm: {
197
+ /** One-shot text transform. At most 8 calls per exec, 2 concurrently. */
198
+ complete(request: LlmRequest): Promise<{ text: string; model: string }>;
199
+ /** Object-root JSON Schema (draft 7), local nonrecursive refs only. Invalid output rejects without retry. */
200
+ json(request: LlmRequest & { schema: Record<string, unknown> }): Promise<{ value: unknown; model: string }>;
201
+ };`;
202
+ function jsonText(value, limit, label) {
203
+ const json = JSON.stringify(value, (_key, item) => {
204
+ if (item === void 0 || typeof item === "function" || typeof item === "symbol" || typeof item === "bigint" || typeof item === "number" && !Number.isFinite(item)) throw new TypeError(`${label} must be JSON serializable.`);
205
+ return item;
206
+ });
207
+ if (json === void 0) throw new TypeError(`${label} must be JSON serializable.`);
208
+ if (new TextEncoder().encode(json).length > limit) throw new RangeError(`${label} exceeds ${limit} bytes.`);
209
+ return json;
210
+ }
211
+ function object(value) {
212
+ return value !== null && typeof value === "object" && !Array.isArray(value);
213
+ }
214
+ /** Reject unsupported references and recursive schemas before spending tokens or entering the validator. */
215
+ function checkedSchema(value) {
216
+ const schema = JSON.parse(jsonText(value, MAX_SCHEMA_BYTES, "LLM schema"));
217
+ if (!object(schema) || schema.type !== "object") throw new TypeError("LLM schema must have type: object.");
218
+ if (schema.$schema !== void 0 && schema.$schema !== "http://json-schema.org/draft-07/schema#") throw new TypeError("LLM schema supports JSON Schema draft 7 only.");
219
+ if (!Check$1(META, schema)) throw new TypeError("Invalid LLM JSON Schema.");
220
+ let expanded = 0;
221
+ const visit = (node, ancestors) => {
222
+ if (!object(node)) return;
223
+ if (++expanded > 1024) throw new TypeError("LLM schema exceeds 1024 expanded schema nodes.");
224
+ if (ancestors.length > 32 || ancestors.includes(node)) throw new TypeError("LLM schema references must be nonrecursive and at most 32 levels deep.");
225
+ const stack = [...ancestors, node];
226
+ if (node.$dynamicRef !== void 0 || node.$recursiveRef !== void 0 || node.$id !== void 0) throw new TypeError("LLM schema supports local $ref only, without $id.");
227
+ if (node.$ref !== void 0) {
228
+ if (typeof node.$ref !== "string" || !node.$ref.startsWith("#/")) throw new TypeError("LLM schema supports local JSON-pointer $ref only.");
229
+ let resolved = schema;
230
+ for (const segment of node.$ref.slice(2).split("/")) {
231
+ const key = segment.replace(/~1/gu, "/").replace(/~0/gu, "~");
232
+ resolved = resolved !== null && typeof resolved === "object" && Object.hasOwn(resolved, key) ? Reflect.get(resolved, key) : void 0;
233
+ }
234
+ if (!object(resolved) && typeof resolved !== "boolean") throw new TypeError("Unresolved LLM schema $ref.");
235
+ visit(resolved, stack);
236
+ }
237
+ for (const key of [
238
+ "properties",
239
+ "patternProperties",
240
+ "definitions",
241
+ "$defs",
242
+ "dependencies"
243
+ ]) if (object(node[key])) for (const child of Object.values(node[key])) visit(child, stack);
244
+ for (const key of [
245
+ "items",
246
+ "additionalItems",
247
+ "additionalProperties",
248
+ "contains",
249
+ "propertyNames",
250
+ "not",
251
+ "if",
252
+ "then",
253
+ "else",
254
+ "allOf",
255
+ "anyOf",
256
+ "oneOf"
257
+ ]) {
258
+ const child = node[key];
259
+ if (Array.isArray(child)) for (const item of child) visit(item, stack);
260
+ else visit(child, stack);
261
+ }
262
+ };
263
+ visit(schema, []);
264
+ return schema;
265
+ }
266
+ function request$1(value, structured) {
267
+ if (!object(value)) throw new TypeError("LLM request must be an object.");
268
+ const allowed = [
269
+ "prompt",
270
+ "input",
271
+ "system",
272
+ "model",
273
+ "maxTokens",
274
+ ...structured ? ["schema"] : []
275
+ ];
276
+ if (Object.keys(value).some((key) => !allowed.includes(key))) throw new TypeError("Unknown LLM request field.");
277
+ if (typeof value.prompt !== "string" || !value.prompt.trim()) throw new TypeError("LLM prompt must be nonempty text.");
278
+ if (value.system !== void 0 && typeof value.system !== "string") throw new TypeError("LLM system must be text.");
279
+ if (value.model !== void 0 && (typeof value.model !== "string" || !MODEL.test(value.model) || value.model.length > 256)) throw new TypeError("LLM model must be provider/modelId.");
280
+ if (value.maxTokens !== void 0 && (!Number.isInteger(value.maxTokens) || Number(value.maxTokens) < 1 || Number(value.maxTokens) > MAX_TOKENS)) throw new RangeError(`LLM maxTokens must be an integer from 1 to ${MAX_TOKENS}.`);
281
+ return {
282
+ prompt: value.prompt,
283
+ ...value.input === void 0 ? {} : { input: value.input },
284
+ ...value.system === void 0 ? {} : { system: value.system },
285
+ ...value.model === void 0 ? {} : { model: value.model },
286
+ ...value.maxTokens === void 0 ? {} : { maxTokens: value.maxTokens },
287
+ ...structured ? { schema: checkedSchema(value.schema) } : {}
288
+ };
289
+ }
290
+ /** Explicit data transforms over the host's guarded completions, never a tool-using agent. */
291
+ function createLlmNamespace(options) {
292
+ const { context } = options;
293
+ return {
294
+ name: "llm",
295
+ summary: "One-shot LLM text and schema-validated JSON transforms. Explicit input only, bounded calls, no tools or retries.",
296
+ declarations: DECLARATIONS$1,
297
+ portable: true,
298
+ bind(run) {
299
+ if (run.sessionId !== context.sessionId) throw new Error("LLM namespace belongs to another session.");
300
+ let disposed = false;
301
+ let calls = 0;
302
+ let active = 0;
303
+ run.onDispose(() => {
304
+ disposed = true;
305
+ });
306
+ const available = () => {
307
+ run.signal.throwIfAborted();
308
+ if (disposed) throw new Error("LLM namespace run is disposed.");
309
+ };
310
+ const call = async (input, structured) => {
311
+ available();
312
+ if (calls >= MAX_CALLS) throw new RangeError(`At most ${MAX_CALLS} LLM calls per exec.`);
313
+ if (active >= MAX_CONCURRENT) throw new RangeError(`At most ${MAX_CONCURRENT} concurrent LLM calls per exec.`);
314
+ const params = request$1(input, structured);
315
+ const userInput = params.input === void 0 ? params.prompt : `${params.prompt}\n\nInput (JSON):\n${jsonText(params.input, MAX_INPUT_BYTES, "LLM input")}`;
316
+ const systemPrompt = `${params.system ?? "Transform only the explicit input according to the request."}${structured ? "\nCall return_result exactly once with the result. Do not call other tools." : ""}`;
317
+ if (new TextEncoder().encode(systemPrompt + userInput).length > MAX_INPUT_BYTES) throw new RangeError("LLM prompt and input exceed 65536 bytes.");
318
+ active += 1;
319
+ const started = Date.now();
320
+ let model;
321
+ let tokens;
322
+ const record = (ok, error) => run.record?.({
323
+ name: structured ? "llm.json" : "llm.complete",
324
+ tool: "llm",
325
+ args: {
326
+ ...model ? { model } : {},
327
+ maxTokens: params.maxTokens ?? DEFAULT_TOKENS
328
+ },
329
+ ok,
330
+ ms: Date.now() - started,
331
+ ...error === void 0 ? {} : { error },
332
+ ...tokens === void 0 ? {} : { result: {
333
+ content: [],
334
+ details: { totalTokens: tokens }
335
+ } }
336
+ });
337
+ try {
338
+ const config = await options.config();
339
+ const current = params.model || config.llmModel ? void 0 : (await context.session.readModelSettings?.())?.model ?? context.model;
340
+ model = params.model ?? config.llmModel ?? (current ? `${current.provider}/${current.id}` : void 0);
341
+ available();
342
+ if (!model || !context.textCompletion?.available(model)) throw new Error(`LLM model is unavailable${model ? `: ${model}` : ""}.`);
343
+ if (structured ? !context.toolCompletion : !context.textCompletion) throw new Error("LLM completion is unavailable on this host.");
344
+ if (calls >= MAX_CALLS) throw new RangeError(`At most ${MAX_CALLS} LLM calls per exec.`);
345
+ calls += 1;
346
+ const completion = {
347
+ systemPrompt,
348
+ input: userInput,
349
+ maxTokens: params.maxTokens ?? DEFAULT_TOKENS,
350
+ signal: run.signal,
351
+ recordUsage: true
352
+ };
353
+ if (!structured) {
354
+ const text = await context.textCompletion.complete(model, completion);
355
+ available();
356
+ jsonText(text, MAX_OUTPUT_BYTES, "LLM output");
357
+ record(true);
358
+ return {
359
+ text,
360
+ model
361
+ };
362
+ }
363
+ const schema = params.schema;
364
+ const response = await context.toolCompletion.complete(model, {
365
+ ...completion,
366
+ tools: [{
367
+ name: RESULT_TOOL,
368
+ description: "Return the requested structured result.",
369
+ parameters: schema
370
+ }]
371
+ });
372
+ tokens = response.usage.totalTokens;
373
+ available();
374
+ if (response.toolCalls.length !== 1 || response.toolCalls[0]?.name !== RESULT_TOOL) throw new Error("LLM must return exactly one return_result call.");
375
+ const value = JSON.parse(jsonText(response.toolCalls[0].arguments, MAX_OUTPUT_BYTES, "LLM output"));
376
+ if (!Check$1(schema, value)) {
377
+ const [, errors] = Errors(schema, value);
378
+ throw new TypeError(`LLM result failed schema validation: ${errors[0]?.message ?? "invalid result"}`);
379
+ }
380
+ record(true);
381
+ return {
382
+ value,
383
+ model
384
+ };
385
+ } catch (error) {
386
+ record(false, error instanceof Error ? error.message : String(error));
387
+ throw error;
388
+ } finally {
389
+ active -= 1;
390
+ }
391
+ };
392
+ return {
393
+ complete: (input) => call(input, false),
394
+ json: (input) => call(input, true)
395
+ };
396
+ }
397
+ };
398
+ }
399
+ //#endregion
400
+ //#region src/services/shellNamespace/index.ts
401
+ const DEFAULT_TIMEOUT_MS = 1e4;
402
+ const MAX_TIMEOUT_MS = 12e4;
403
+ const MAX_COMMAND_CHARS = 65536;
404
+ const MAX_OUTPUT_CHARS = 32768;
405
+ const TRUNCATED = "\n[truncated]";
406
+ const DECLARATIONS = `declare const shell: {
407
+ /** Short foreground Bash command in the session cwd/environment. Nonzero exits are returned; cancellation and timeout reject. */
408
+ bash(input: { command: string; timeoutMs?: number }): Promise<{ stdout: string; stderr: string; exitCode: number }>;
409
+ };`;
410
+ function request(input) {
411
+ if (input === null || typeof input !== "object" || Array.isArray(input)) throw new TypeError("shell.bash expects an object.");
412
+ const value = input;
413
+ if (Object.keys(value).some((key) => key !== "command" && key !== "timeoutMs")) throw new TypeError("shell.bash accepts only command and timeoutMs.");
414
+ if (typeof value.command !== "string" || !value.command.trim() || value.command.length > MAX_COMMAND_CHARS) throw new TypeError(`shell.bash command must be nonempty text of at most ${MAX_COMMAND_CHARS} characters.`);
415
+ if (value.timeoutMs !== void 0 && (!Number.isInteger(value.timeoutMs) || Number(value.timeoutMs) < 1 || Number(value.timeoutMs) > MAX_TIMEOUT_MS)) throw new RangeError(`shell.bash timeoutMs must be an integer from 1 to ${MAX_TIMEOUT_MS}.`);
416
+ return {
417
+ command: value.command,
418
+ timeoutMs: value.timeoutMs
419
+ };
420
+ }
421
+ /** Deadline-bound commands for post-processing, separate from Runner's supervised processes. */
422
+ function createShellNamespace(options) {
423
+ return {
424
+ name: "shell",
425
+ summary: "Run short foreground Bash commands with bounded stdout/stderr and a deadline. No background or interactive mode.",
426
+ declarations: DECLARATIONS,
427
+ portable: true,
428
+ bind(run) {
429
+ if (run.sessionId !== options.context.sessionId) throw new Error("Shell namespace belongs to another session.");
430
+ const disposal = new AbortController();
431
+ const lifetime = AbortSignal.any([run.signal, disposal.signal]);
432
+ run.onDispose(() => disposal.abort(/* @__PURE__ */ new Error("Shell namespace run is disposed.")));
433
+ return { async bash(input) {
434
+ lifetime.throwIfAborted();
435
+ const params = request(input);
436
+ const shell = options.shell();
437
+ if (!shell) throw new Error("Shell commands are not available on this host.");
438
+ const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS;
439
+ const signal = AbortSignal.any([lifetime, AbortSignal.timeout(timeoutMs)]);
440
+ const output = {
441
+ stdout: "",
442
+ stderr: ""
443
+ };
444
+ const truncated = {
445
+ stdout: false,
446
+ stderr: false
447
+ };
448
+ const started = Date.now();
449
+ let ok = false;
450
+ let failure;
451
+ try {
452
+ const result = await shell.exec(params.command, {
453
+ cwd: options.context.cwd,
454
+ env: Object.fromEntries(Object.entries(options.context.environment).filter((entry) => entry[1] !== void 0)),
455
+ inheritEnv: false,
456
+ onOutput: (text, _context, { stream }) => {
457
+ const remaining = MAX_OUTPUT_CHARS - output[stream].length;
458
+ output[stream] += text.slice(0, remaining);
459
+ if (text.length > remaining) truncated[stream] = true;
460
+ }
461
+ }, withAbortSignal(signal, BACKGROUND_CONTEXT));
462
+ signal.throwIfAborted();
463
+ const { exitCode } = getOrThrow(result);
464
+ ok = exitCode === 0;
465
+ return {
466
+ stdout: output.stdout + (truncated.stdout ? TRUNCATED : ""),
467
+ stderr: output.stderr + (truncated.stderr ? TRUNCATED : ""),
468
+ exitCode
469
+ };
470
+ } catch (error) {
471
+ failure = error instanceof Error ? error.message : String(error);
472
+ throw error;
473
+ } finally {
474
+ run.record?.({
475
+ name: "shell.bash",
476
+ tool: "shell",
477
+ args: { timeoutMs },
478
+ ok,
479
+ ms: Date.now() - started,
480
+ ...failure === void 0 ? {} : { error: failure }
481
+ });
482
+ }
483
+ } };
484
+ }
485
+ };
486
+ }
487
+ //#endregion
116
488
  //#region src/extensions/workspaces/sessions/(backend)/_lib/root.server.ts
117
489
  /** One registry per session: contributors register into it, `discover` and `exec` read it. */
118
- function createCodemodeSession({ context }) {
490
+ function createCodemodeSession({ context, agent, host }) {
119
491
  const registry = createCodemodeRegistry();
120
492
  context.inject([PO_SERVER_SCOPE_SERVICE], (scoped) => requirePoServerScope(scoped).provide(PO_CODEMODE_CONTRACT, registry));
121
493
  let temporaryDirectory;
@@ -130,14 +502,46 @@ function createCodemodeSession({ context }) {
130
502
  fs: () => readPoFs(context),
131
503
  temporaryDirectory: () => temporaryDirectory
132
504
  });
133
- return { value: {
134
- registry,
135
- ...createCodemodeTools({
505
+ const execution = agent?.context;
506
+ const config = execution ? new LlmConfigService({
507
+ fs: () => readPoFs(context),
508
+ environment: execution.environment,
509
+ homeDirectory: host.context.homeDirectory
510
+ }) : void 0;
511
+ let disposeNamespaces;
512
+ if (execution && config) {
513
+ context.inject([PO_CONFIG_SERVICE], (scoped) => {
514
+ const service = scoped.get(PO_CONFIG_SERVICE);
515
+ return service ? config.bind(() => service.getSnapshot()) : void 0;
516
+ });
517
+ const registration = registry.register("@agimon-ai/po-codemode", createLlmNamespace({
518
+ context: execution,
519
+ config: () => config.current()
520
+ }));
521
+ const shellRegistration = registry.register("@agimon-ai/po-codemode", createShellNamespace({
522
+ context: execution,
523
+ shell: () => context.get(PO_SHELL_SERVICE)
524
+ }));
525
+ disposeNamespaces = () => {
526
+ registration.dispose();
527
+ shellRegistration.dispose();
528
+ };
529
+ }
530
+ return {
531
+ value: {
136
532
  registry,
137
- isolate: () => readPoIsolate(context),
138
- scripts
139
- })
140
- } };
533
+ ...createCodemodeTools({
534
+ registry,
535
+ isolate: () => readPoIsolate(context),
536
+ npm: () => readPoNpm(context),
537
+ scripts
538
+ })
539
+ },
540
+ services: [(scoped) => {
541
+ if (config) scoped.provide(PO_CODEMODE_LLM_CONFIG_SERVICE, config);
542
+ }],
543
+ onDispose: () => disposeNamespaces?.()
544
+ };
141
545
  }
142
546
  const root = defineRoot(createCodemodeSession);
143
547
  //#endregion
@@ -147,14 +551,34 @@ var root_server_default = defineRoot(root);
147
551
  //#region src/extensions/workspaces/sessions/(backend)/contract/codemode.server.ts
148
552
  var codemode_server_default = defineServiceContract(PO_CODEMODE_SERVICE, { scope: "session" });
149
553
  //#endregion
150
- //#region src/extensions/workspaces/sessions/(backend)/resource/po-use-codemode.server.ts
151
- var po_use_codemode_server_default = defineResource({
152
- name: "po-use-codemode",
554
+ //#region src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-llm.server.ts
555
+ var codemode_how_to_llm_server_default = defineResource({
556
+ name: "codemode-how-to-llm",
557
+ description: "Use the llm namespace for one-shot text and schema-checked JSON transformations inside exec.",
558
+ pinned: true,
559
+ kind: "skill",
560
+ path: packageResourcePath(import.meta.url, "src/prompts/codemode-how-to-llm/SKILL.md"),
561
+ read: () => readPackageResource(import.meta.url, "src/prompts/codemode-how-to-llm/SKILL.md")
562
+ });
563
+ //#endregion
564
+ //#region src/extensions/workspaces/sessions/(backend)/resource/codemode-how-to-shell.server.ts
565
+ var codemode_how_to_shell_server_default = defineResource({
566
+ name: "codemode-how-to-shell",
567
+ description: "Use shell.bash for short deadline-bound Bash commands and code-side output post-processing.",
568
+ pinned: true,
569
+ kind: "skill",
570
+ path: packageResourcePath(import.meta.url, "src/prompts/codemode-how-to-shell/SKILL.md"),
571
+ read: () => readPackageResource(import.meta.url, "src/prompts/codemode-how-to-shell/SKILL.md")
572
+ });
573
+ //#endregion
574
+ //#region src/extensions/workspaces/sessions/(backend)/resource/how-to-codemode.server.ts
575
+ var how_to_codemode_server_default = defineResource({
576
+ name: "how-to-codemode",
153
577
  description: "Use @agimon-ai/po-codemode: Code mode for Po sessions: discover and exec over namespaces other packages contribute",
154
- when: PO_HELP_WHEN,
578
+ pinned: true,
155
579
  kind: "skill",
156
- path: packageResourcePath(import.meta.url, "src/prompts/po-use-codemode/SKILL.md"),
157
- read: () => readPackageResource(import.meta.url, "src/prompts/po-use-codemode/SKILL.md")
580
+ path: packageResourcePath(import.meta.url, "src/prompts/how-to-codemode/SKILL.md"),
581
+ read: () => readPackageResource(import.meta.url, "src/prompts/how-to-codemode/SKILL.md")
158
582
  });
159
583
  //#endregion
160
584
  //#region src/extensions/workspaces/sessions/(backend)/tool/discover.server.ts
@@ -183,7 +607,11 @@ const serverPlugin = defineServerPlugin({
183
607
  return {
184
608
  ...composeRootHooks(scopeSession),
185
609
  get resources() {
186
- return [at(po_use_codemode_server_default, contextSession)];
610
+ return [
611
+ at(codemode_how_to_llm_server_default, contextSession),
612
+ at(codemode_how_to_shell_server_default, contextSession),
613
+ at(how_to_codemode_server_default, contextSession)
614
+ ];
187
615
  },
188
616
  get tools() {
189
617
  return [via({ name: "discover" }, at(discover_server_default, contextSession)), via({ name: "exec" }, at(exec_server_default, contextSession))];