indusagi-coding-agent 0.2.1 → 0.2.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/entry.js +18609 -9511
  3. package/dist/guardrails.js +8173 -55
  4. package/dist/index.js +20332 -11227
  5. package/dist/types/boot/runners/delegate-runner.d.ts +6 -0
  6. package/dist/types/boot/runners/session.d.ts +2 -17
  7. package/dist/types/capability-deck/cards/index.d.ts +1 -0
  8. package/dist/types/capability-deck/cards/task-card.d.ts +26 -2
  9. package/dist/types/capability-deck/cards/workflow-card.d.ts +55 -0
  10. package/dist/types/capability-deck/cards/workflow-card.test.d.ts +12 -0
  11. package/dist/types/capability-deck/index.d.ts +1 -1
  12. package/dist/types/conductor/contract.d.ts +8 -0
  13. package/dist/types/conductor/signal-hub/translate.d.ts +4 -1
  14. package/dist/types/console/components/AgentsView.d.ts +41 -0
  15. package/dist/types/console/components/BackgroundAgents.d.ts +63 -0
  16. package/dist/types/console/components/BackgroundAgents.test.d.ts +8 -0
  17. package/dist/types/console/components/Banner.d.ts +67 -33
  18. package/dist/types/console/components/welcome.d.ts +115 -0
  19. package/dist/types/console/components/welcome.test.d.ts +9 -0
  20. package/dist/types/console/contract.d.ts +3 -1
  21. package/dist/types/console/index.d.ts +3 -0
  22. package/dist/types/console/input/keymap.d.ts +1 -1
  23. package/dist/types/console/input/paste.d.ts +5 -5
  24. package/dist/types/console/overlays/boards.d.ts +55 -0
  25. package/dist/types/console/theme/adapter.d.ts +1 -1
  26. package/dist/types/console/theme/index.d.ts +1 -1
  27. package/dist/types/console/theme/palette.d.ts +10 -0
  28. package/dist/types/workflow-engine/agent-runner.d.ts +105 -0
  29. package/dist/types/workflow-engine/agent-runner.test.d.ts +8 -0
  30. package/dist/types/workflow-engine/display.d.ts +148 -0
  31. package/dist/types/workflow-engine/display.test.d.ts +1 -0
  32. package/dist/types/workflow-engine/engine.d.ts +183 -0
  33. package/dist/types/workflow-engine/engine.test.d.ts +1 -0
  34. package/dist/types/workflow-engine/index.d.ts +21 -0
  35. package/dist/types/workflow-engine/parse.d.ts +64 -0
  36. package/dist/types/workflow-engine/parse.test.d.ts +1 -0
  37. package/dist/types/workflow-engine/structured-output.d.ts +51 -0
  38. package/dist/types/workflow-engine/structured-output.test.d.ts +1 -0
  39. package/dist/types/workspace/brand.d.ts +1 -1
  40. package/package.json +2 -2
  41. package/dist/types/console/components/Emblem.d.ts +0 -49
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Workflow script parser — extract and validate the leading `meta` export,
3
+ * enforce determinism, and hand back the runnable sandbox body.
4
+ *
5
+ * A workflow script is plain JavaScript whose FIRST statement must be
6
+ * `export const meta = { ... }` (an object literal). This module:
7
+ *
8
+ * 1. locates that leading export with a lexer-free, dependency-free scan,
9
+ * 2. evaluates ONLY the `{ ... }` literal in a frozen, empty Node `vm`
10
+ * sandbox (no globals reachable, so the literal cannot call into
11
+ * anything), capturing the resulting plain object as {@link WorkflowMeta},
12
+ * 3. validates the meta shape (name/description required, optional
13
+ * whenToUse/phases),
14
+ * 4. enforces the determinism guard over the WHOLE script source —
15
+ * `Date.now()`, `Math.random()`, and `new Date()` are rejected so a
16
+ * workflow always produces the same orchestration plan, and
17
+ * 5. strips the `export const meta = …;` statement so the remaining `body`
18
+ * runs as an ordinary async function body inside the engine sandbox.
19
+ *
20
+ * This is a dependency-free port of pi's acorn-based `parseWorkflowScript`
21
+ * (pi-dynamic-workflows/src/workflow.ts). It deliberately does NOT pull in
22
+ * `acorn`: the only thing the engine needs to read out of the source is the
23
+ * leading literal, which a sandboxed `Function`/`vm` evaluation of that one
24
+ * expression handles safely, and the determinism guard is a source string-scan
25
+ * over the call/`new` forms pi's AST walk rejected.
26
+ */
27
+ /** One declared phase in the upfront `meta.phases` outline. */
28
+ export interface WorkflowMetaPhase {
29
+ /** Human title for the phase row. */
30
+ title: string;
31
+ /** Optional one-line elaboration of what the phase does. */
32
+ detail?: string;
33
+ /** Optional model hint the phase prefers (documentation only). */
34
+ model?: string;
35
+ }
36
+ /** The validated `export const meta = { … }` header of a workflow script. */
37
+ export interface WorkflowMeta {
38
+ /** Short snake_case identifier for the workflow. */
39
+ name: string;
40
+ /** Non-empty human description of what the workflow accomplishes. */
41
+ description: string;
42
+ /** Optional guidance on when a model should reach for this workflow. */
43
+ whenToUse?: string;
44
+ /** Optional upfront outline; live progress is still driven by `phase()`. */
45
+ phases?: WorkflowMetaPhase[];
46
+ }
47
+ /** The result of {@link parseWorkflowScript}: validated meta + runnable body. */
48
+ export interface ParsedWorkflow {
49
+ /** The validated workflow header. */
50
+ meta: WorkflowMeta;
51
+ /** The script with the leading `export const meta = …` statement removed. */
52
+ body: string;
53
+ }
54
+ /** Message raised when a script reaches for a non-deterministic primitive. */
55
+ export declare const NONDETERMINISM_ERROR = "Workflow scripts must be deterministic: Date.now()/Math.random()/new Date() are unavailable";
56
+ /**
57
+ * Parse a workflow script into its validated {@link WorkflowMeta} and the
58
+ * runnable `body` (the script with the meta export removed).
59
+ *
60
+ * @param script the raw workflow JavaScript source
61
+ * @throws if the first statement is not `export const meta = {literal}`, if the
62
+ * meta fails validation, or if the source uses a non-deterministic primitive
63
+ */
64
+ export declare function parseWorkflowScript(script: string): ParsedWorkflow;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,51 @@
1
+ /**
2
+ * structured_output — the per-subagent "final answer channel" tool.
3
+ *
4
+ * A workflow subagent that needs to return a machine-readable result is given a
5
+ * tool named `structured_output` whose `parameters` ARE the caller-supplied
6
+ * TypeBox schema. When the subagent calls it, the framework has already
7
+ * validated the arguments against that schema, so `execute` simply records the
8
+ * validated value into a shared {@link StructuredOutputCapture} and returns a
9
+ * normal {@link AgentToolResult}.
10
+ *
11
+ * Difference from pi's version (pi-dynamic-workflows/src/structured-output.ts):
12
+ * the indus-code-rebuild framework `AgentToolResult` has NO `terminate` flag
13
+ * (see {@link "indusagi/agent"} `AgentToolResult`), so this tool does NOT end
14
+ * the subagent's loop early. The stage-2 runner instead runs the subagent to
15
+ * completion and reads `capture.value` afterward. This file is therefore a
16
+ * plain {@link AgentTool} object literal (no `defineTool`, no `terminate`).
17
+ */
18
+ import type { Static, TSchema } from "@sinclair/typebox";
19
+ import type { AgentTool } from "../capability-deck";
20
+ /**
21
+ * Mutable sink the {@link createStructuredOutputTool} tool writes into. The
22
+ * runner constructs one per subagent run, passes it in, and reads `value` after
23
+ * the subagent finishes.
24
+ */
25
+ export interface StructuredOutputCapture<T = unknown> {
26
+ /** The last validated payload the subagent submitted, if any. */
27
+ value: T | undefined;
28
+ /** Whether `structured_output` was ever called during the run. */
29
+ called: boolean;
30
+ }
31
+ /** Options for {@link createStructuredOutputTool}. */
32
+ export interface StructuredOutputToolOptions<TSchemaDef extends TSchema> {
33
+ /** The TypeBox schema the subagent's result must satisfy. */
34
+ schema: TSchemaDef;
35
+ /** The capture sink the validated result is recorded into. */
36
+ capture: StructuredOutputCapture<Static<TSchemaDef>>;
37
+ /** Override the tool name (defaults to `structured_output`). */
38
+ name?: string;
39
+ }
40
+ /**
41
+ * Build the `structured_output` capture tool for one subagent run.
42
+ *
43
+ * The returned tool's `parameters` are exactly `schema`, so the framework
44
+ * validates the subagent's arguments before `execute` runs; `execute` then
45
+ * records them into `capture` and acknowledges. Idempotent in the sense that a
46
+ * second call simply overwrites `capture.value` with the newer payload.
47
+ *
48
+ * @param options the result schema, the capture sink, and an optional name
49
+ * @returns an {@link AgentTool} whose parameters mirror the caller schema
50
+ */
51
+ export declare function createStructuredOutputTool<TSchemaDef extends TSchema>({ schema, capture, name, }: StructuredOutputToolOptions<TSchemaDef>): AgentTool<TSchemaDef, Static<TSchemaDef>>;
@@ -23,4 +23,4 @@ export declare const BRAND: Brand;
23
23
  * Single source of truth: bump this one line per release. Co-located with the
24
24
  * brand so `boot` reads it without importing the index barrel.
25
25
  */
26
- export declare const VERSION = "0.2.0";
26
+ export declare const VERSION = "0.2.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "indusagi-coding-agent",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Indusagi coding agent — a terminal-first AI coding agent, built from scratch on the indusagi framework.",
5
5
  "author": "Varun Israni",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "@sinclair/typebox": "^0.34.49",
58
58
  "chalk": "^5.6.2",
59
59
  "highlight.js": "^11.11.1",
60
- "indusagi": "^0.13.0",
60
+ "indusagi": "^0.13.2",
61
61
  "ink": "^5.2.1",
62
62
  "jiti": "^2.7.0",
63
63
  "marked": "^18.0.4",
@@ -1,49 +0,0 @@
1
- /**
2
- * Emblem — the two-tone block monogram that sits to the left of the wordmark
3
- * (roadmap #2).
4
- *
5
- * Before this, the masthead was lettering alone — the "INDUS CODE" wordmark
6
- * *was* the whole identity, painted in one flat accent. The emblem gives the
7
- * brand a *mark*: a small fixed-width block glyph built from the box quadrant
8
- * family (`▛ ▜ ▙ ▟ ▝ ▘ ▗ ▖ █ ▓`), split per row into a bright "fill" span and a
9
- * dim "shadow" span so it reads as a single solid shape lit from one corner.
10
- * The fill is the primary accent; the shadow is the secondary accent — the two
11
- * distinct palette hues the scheme already carries — so the mark is genuinely
12
- * two-tone rather than a single colour with a darker edge.
13
- *
14
- * It is purely presentational: a fixed glyph grid tinted through the framework
15
- * {@link InkThemeAdapter} at render time, no state, no effects, no props beyond
16
- * the theme and an optional row-colour override the banner uses to fold the
17
- * emblem's fill into a frozen colour-sweep.
18
- *
19
- * Layout is a `flexDirection="column"` of one `<Box>` per row; within a row the
20
- * fill and shadow are adjacent `<Text>` spans so each row's two tones share a
21
- * line. The whole emblem is the same display width on every row, so it stacks
22
- * into a clean column the wordmark can sit beside in a parent row Box.
23
- */
24
- import type { InkThemeAdapter } from "indusagi/react-ink";
25
- /** How many terminal rows the emblem occupies (its glyph-grid height). */
26
- export declare const EMBLEM_HEIGHT: number;
27
- /** What the {@link Emblem} renders. */
28
- export interface EmblemProps {
29
- /** The framework adapter that turns token roles into terminal colours. */
30
- readonly theme: InkThemeAdapter;
31
- /**
32
- * Optional per-row fill colour (a `#rrggbb` hex), indexed by row. When supplied
33
- * (the banner's frozen colour-sweep), row `i`'s fill is painted with
34
- * `rowColors[i]` via chalk's hex path instead of the flat accent role; the
35
- * shadow keeps the secondary accent so the mark stays two-tone. Absent rows
36
- * fall back to the accent role.
37
- */
38
- readonly rowColors?: readonly string[];
39
- }
40
- /**
41
- * Render the two-tone block emblem.
42
- *
43
- * Each row paints its fill span in the accent role (or the supplied sweep colour
44
- * for that row) and its shadow span in the secondary `customMessage` role, so the
45
- * monogram reads as one solid mark with a lit and a shadowed face.
46
- *
47
- * @param props the theme adapter and an optional per-row fill-colour override
48
- */
49
- export declare function Emblem({ theme, rowColors }: EmblemProps): JSX.Element;