clanka 0.25.0 → 0.25.1

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/src/AgentTools.ts CHANGED
@@ -370,6 +370,13 @@ export const AgentTools = Toolkit.make(
370
370
  success: Schema.NullOr(Schema.String),
371
371
  dependencies: [CurrentDirectory, ImageAttacher],
372
372
  }),
373
+ Tool.make("run", {
374
+ description:
375
+ "Run a shell command and return its output. If it takes too long it will become a background task. Use 'bash' for more control.",
376
+ parameters: Schema.String.annotate({ identifier: "command" }),
377
+ success: Schema.String,
378
+ dependencies: [CurrentDirectory],
379
+ }),
373
380
  Tool.make("rg", {
374
381
  description: "Search for a pattern in files using ripgrep",
375
382
  parameters: Schema.Struct({
@@ -399,23 +406,6 @@ export const AgentTools = Toolkit.make(
399
406
  failure: Schema.String,
400
407
  dependencies: [AgentTaskExecutor],
401
408
  }),
402
- Tool.make("messageAgent", {
403
- description: "Send a message to one of your sub-agents.",
404
- parameters: Schema.Struct({
405
- id: Schema.String,
406
- message: Schema.String,
407
- }),
408
- failure: Schema.String,
409
- dependencies: [AgentTaskExecutor],
410
- }),
411
- Tool.make("glob", {
412
- description: "Find files matching a glob pattern.",
413
- parameters: Schema.String.annotate({
414
- identifier: "pattern",
415
- }),
416
- success: Schema.Array(Schema.String),
417
- dependencies: [CurrentDirectory],
418
- }),
419
409
  Tool.make("gh", {
420
410
  description:
421
411
  "Use the GitHub CLI to run a command - use this instead of the bash tool.",
@@ -426,51 +416,6 @@ export const AgentTools = Toolkit.make(
426
416
  dependencies: [CurrentDirectory],
427
417
  }),
428
418
  makeBashTool(defaultBashTimeout),
429
- Tool.make("run", {
430
- description:
431
- "Run a bash command in the foreground and return its output. If it takes longer than 2 minutes it will become a background task.",
432
- parameters: Schema.String.annotate({ identifier: "command" }),
433
- success: Schema.String,
434
- dependencies: [CurrentDirectory],
435
- }),
436
- Tool.make("taskOutput", {
437
- description:
438
- "Return the status and output so far of one of your tasks: a background bash command or a sub-agent.",
439
- parameters: Schema.String.annotate({
440
- identifier: "id",
441
- }),
442
- success: Task,
443
- failure: Schema.String,
444
- dependencies: [AgentTaskExecutor],
445
- }),
446
- Tool.make("waitTasks", {
447
- description:
448
- "Wait until the given tasks have ended and return them, in the order given.",
449
- parameters: Schema.Struct({
450
- ids: Schema.Array(Schema.String),
451
- timeoutMs: Schema.optional(Schema.Finite).annotate({
452
- documentation:
453
- "How long to wait in ms (default and max: the bash command timeout)",
454
- }),
455
- }),
456
- success: Schema.Array(Task),
457
- failure: Schema.String,
458
- dependencies: [AgentTaskExecutor],
459
- }),
460
- Tool.make("stopTask", {
461
- description: "Stop one of your tasks.",
462
- parameters: Schema.String.annotate({
463
- identifier: "id",
464
- }),
465
- failure: Schema.String,
466
- dependencies: [AgentTaskExecutor],
467
- }),
468
- Tool.make("listTasks", {
469
- description: "List the tasks you have started, with their status.",
470
- parameters: Schema.Void,
471
- success: Schema.Array(Task),
472
- dependencies: [AgentTaskExecutor],
473
- }),
474
419
  Tool.make("applyPatch", {
475
420
  description:
476
421
  "Add, update or remove multiple files with a git diff / unified diff / wrapped patch.",
@@ -534,6 +479,53 @@ export const AgentTools = Toolkit.make(
534
479
  identifier: "ms",
535
480
  }),
536
481
  }),
482
+ Tool.make("taskOutput", {
483
+ description:
484
+ "Return the status and output so far of one of your tasks: a background bash command or a sub-agent.",
485
+ parameters: Schema.String.annotate({
486
+ identifier: "id",
487
+ }),
488
+ success: Task,
489
+ failure: Schema.String,
490
+ dependencies: [AgentTaskExecutor],
491
+ }),
492
+ Tool.make("waitTasks", {
493
+ description:
494
+ "Wait until the given tasks have ended and return them, in the order given.",
495
+ parameters: Schema.Struct({
496
+ ids: Schema.Array(Schema.String),
497
+ timeoutMs: Schema.optional(Schema.Finite).annotate({
498
+ documentation:
499
+ "How long to wait in ms (default and max: the bash command timeout)",
500
+ }),
501
+ }),
502
+ success: Schema.Array(Task),
503
+ failure: Schema.String,
504
+ dependencies: [AgentTaskExecutor],
505
+ }),
506
+ Tool.make("stopTask", {
507
+ description: "Stop one of your tasks.",
508
+ parameters: Schema.String.annotate({
509
+ identifier: "id",
510
+ }),
511
+ failure: Schema.String,
512
+ dependencies: [AgentTaskExecutor],
513
+ }),
514
+ Tool.make("listTasks", {
515
+ description: "List the tasks you have started, with their status.",
516
+ parameters: Schema.Void,
517
+ success: Schema.Array(Task),
518
+ dependencies: [AgentTaskExecutor],
519
+ }),
520
+ Tool.make("messageAgent", {
521
+ description: "Send a message to one of your sub-agents.",
522
+ parameters: Schema.Struct({
523
+ id: Schema.String,
524
+ message: Schema.String,
525
+ }),
526
+ failure: Schema.String,
527
+ dependencies: [AgentTaskExecutor],
528
+ }),
537
529
  Tool.make("taskComplete", {
538
530
  description:
539
531
  "Only call this when the task is fully complete and you have a final output message to send.",
@@ -936,15 +928,6 @@ export const AgentToolHandlersNoDeps = AgentToolsWithSearch.toLayer(
936
928
  }
937
929
  return yield* run(args.slice(0, -1).concat("-uu", options.pattern))
938
930
  }),
939
- glob: Effect.fn("AgentTools.glob")(function* (pattern) {
940
- yield* Effect.logInfo(`Calling "glob"`).pipe(
941
- Effect.annotateLogs({ pattern }),
942
- )
943
- const cwd = yield* CurrentDirectory
944
- return yield* Effect.promise(() =>
945
- import("glob").then((Glob) => Glob.glob(pattern, { cwd })),
946
- )
947
- }),
948
931
  bash,
949
932
  run: Effect.fn("AgentTools.run")(function* (command) {
950
933
  const task = yield* bash({ command, timeoutMs: 120_000 })