@cleocode/contracts 2026.5.98 → 2026.5.100

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 (78) hide show
  1. package/dist/__tests__/operations-registry.test.d.ts +15 -0
  2. package/dist/__tests__/operations-registry.test.d.ts.map +1 -0
  3. package/dist/__tests__/operations-registry.test.js +48 -0
  4. package/dist/__tests__/operations-registry.test.js.map +1 -0
  5. package/dist/dispatch/operations-registry.d.ts +33 -0
  6. package/dist/dispatch/operations-registry.d.ts.map +1 -0
  7. package/dist/dispatch/operations-registry.js +7709 -0
  8. package/dist/dispatch/operations-registry.js.map +1 -0
  9. package/dist/index.d.ts +12 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +2 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/project-tools.d.ts +105 -0
  14. package/dist/project-tools.d.ts.map +1 -0
  15. package/dist/project-tools.js +14 -0
  16. package/dist/project-tools.js.map +1 -0
  17. package/dist/release/plan.d.ts +3 -3
  18. package/dist/tools/brain-fetch.d.ts +22 -0
  19. package/dist/tools/brain-fetch.d.ts.map +1 -0
  20. package/dist/tools/brain-fetch.js +9 -0
  21. package/dist/tools/brain-fetch.js.map +1 -0
  22. package/dist/tools/brain-observe.d.ts +22 -0
  23. package/dist/tools/brain-observe.d.ts.map +1 -0
  24. package/dist/tools/brain-observe.js +9 -0
  25. package/dist/tools/brain-observe.js.map +1 -0
  26. package/dist/tools/brain-search.d.ts +22 -0
  27. package/dist/tools/brain-search.d.ts.map +1 -0
  28. package/dist/tools/brain-search.js +9 -0
  29. package/dist/tools/brain-search.js.map +1 -0
  30. package/dist/tools/brain-timeline.d.ts +22 -0
  31. package/dist/tools/brain-timeline.d.ts.map +1 -0
  32. package/dist/tools/brain-timeline.js +9 -0
  33. package/dist/tools/brain-timeline.js.map +1 -0
  34. package/dist/tools/build-retrieval-bundle.d.ts +22 -0
  35. package/dist/tools/build-retrieval-bundle.d.ts.map +1 -0
  36. package/dist/tools/build-retrieval-bundle.js +9 -0
  37. package/dist/tools/build-retrieval-bundle.js.map +1 -0
  38. package/dist/tools/build-task-tree.d.ts +44 -0
  39. package/dist/tools/build-task-tree.d.ts.map +1 -0
  40. package/dist/tools/build-task-tree.js +9 -0
  41. package/dist/tools/build-task-tree.js.map +1 -0
  42. package/dist/tools/compute-critical-path.d.ts +33 -0
  43. package/dist/tools/compute-critical-path.d.ts.map +1 -0
  44. package/dist/tools/compute-critical-path.js +9 -0
  45. package/dist/tools/compute-critical-path.js.map +1 -0
  46. package/dist/tools/describe-schema.d.ts +40 -0
  47. package/dist/tools/describe-schema.d.ts.map +1 -0
  48. package/dist/tools/describe-schema.js +9 -0
  49. package/dist/tools/describe-schema.js.map +1 -0
  50. package/dist/tools/index.d.ts +19 -0
  51. package/dist/tools/index.d.ts.map +1 -0
  52. package/dist/tools/index.js +10 -0
  53. package/dist/tools/index.js.map +1 -0
  54. package/dist/tools/render-task-tree.d.ts +18 -0
  55. package/dist/tools/render-task-tree.d.ts.map +1 -0
  56. package/dist/tools/render-task-tree.js +9 -0
  57. package/dist/tools/render-task-tree.js.map +1 -0
  58. package/dist/tools/score-task-priority.d.ts +59 -0
  59. package/dist/tools/score-task-priority.d.ts.map +1 -0
  60. package/dist/tools/score-task-priority.js +9 -0
  61. package/dist/tools/score-task-priority.js.map +1 -0
  62. package/package.json +2 -2
  63. package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +3 -0
  64. package/src/__tests__/operations-registry.test.ts +53 -0
  65. package/src/dispatch/operations-registry.ts +7987 -0
  66. package/src/index.ts +45 -0
  67. package/src/project-tools.ts +117 -0
  68. package/src/tools/brain-fetch.ts +25 -0
  69. package/src/tools/brain-observe.ts +25 -0
  70. package/src/tools/brain-search.ts +25 -0
  71. package/src/tools/brain-timeline.ts +25 -0
  72. package/src/tools/build-retrieval-bundle.ts +25 -0
  73. package/src/tools/build-task-tree.ts +48 -0
  74. package/src/tools/compute-critical-path.ts +35 -0
  75. package/src/tools/describe-schema.ts +43 -0
  76. package/src/tools/index.ts +43 -0
  77. package/src/tools/render-task-tree.ts +19 -0
  78. package/src/tools/score-task-priority.ts +59 -0
package/src/index.ts CHANGED
@@ -274,6 +274,8 @@ export type { CanonicalDomain, Gateway, Tier } from './dispatch/identity.js';
274
274
  export { CANONICAL_DOMAINS } from './dispatch/identity.js';
275
275
  // === Dispatch OperationDef + Resolution (T9954 — Phase 0b of SG-ARCH-SOLID / E-CONTRACTS-FOUNDATION) ===
276
276
  export type { OperationDef, Resolution } from './dispatch/operation-def.js';
277
+ // === Dispatch OPERATIONS data + builder helpers (T10061 — T9833b / E-CLI-BOUNDARY / SG-ARCH-SOLID) ===
278
+ export { defineDomain, defineOp, OPERATIONS } from './dispatch/operations-registry.js';
277
279
  // === DocsAccessor Contracts (T9063) ===
278
280
  export type {
279
281
  DocExportFormat,
@@ -1330,6 +1332,15 @@ export type {
1330
1332
  ProjectType,
1331
1333
  TestFramework,
1332
1334
  } from './project-context.js';
1335
+ // === ProjectTools Contracts (scaffold-project, doctor-project, scaffold-global — T10069 / T9835b) ===
1336
+ export type {
1337
+ DoctorProjectOptions,
1338
+ DoctorProjectResult,
1339
+ ScaffoldGlobalResult,
1340
+ ScaffoldProjectOptions,
1341
+ ScaffoldProjectResult,
1342
+ ScaffoldProjectStep,
1343
+ } from './project-tools.js';
1333
1344
  // === Provenance Graph Unions (T9955 — promoted from core/store/tasks-schema.ts) ===
1334
1345
  // Note: ReleaseChannel/ReleaseKind/ReleaseScheme/ReleaseStatus collide with the
1335
1346
  // existing `./release/channel.js` + `./release/plan.js` + `./task.js` exports
@@ -1719,6 +1730,40 @@ export type {
1719
1730
  TesseraTemplate,
1720
1731
  TesseraVariable,
1721
1732
  } from './tessera.js';
1733
+ export type { FetchBrainEntriesInput, FetchBrainEntriesOutput } from './tools/brain-fetch.js';
1734
+ export type { ObserveBrainInput, ObserveBrainOutput } from './tools/brain-observe.js';
1735
+ // === SDK Tool Contracts (T10068 / T10070 / T9835) ===
1736
+ // BrainTools (T10070 / T9835c)
1737
+ export type { SearchBrainInput, SearchBrainOutput } from './tools/brain-search.js';
1738
+ export type { TimelineBrainInput, TimelineBrainOutput } from './tools/brain-timeline.js';
1739
+ export type {
1740
+ BuildRetrievalBundleInput,
1741
+ BuildRetrievalBundleOutput,
1742
+ } from './tools/build-retrieval-bundle.js';
1743
+ // TaskTools (T10068 / T9835b)
1744
+ export type {
1745
+ BuildTaskTreeInput,
1746
+ BuildTaskTreeOptions,
1747
+ BuildTaskTreeResult,
1748
+ } from './tools/build-task-tree.js';
1749
+ export type {
1750
+ CriticalPathEdge,
1751
+ CriticalPathNode,
1752
+ CriticalPathResult,
1753
+ } from './tools/compute-critical-path.js';
1754
+ export type {
1755
+ SchemaColumn,
1756
+ SchemaDescriptor,
1757
+ SchemaIndex,
1758
+ SchemaTableDescriptor,
1759
+ } from './tools/describe-schema.js';
1760
+ export type { RenderTaskTreeInput } from './tools/render-task-tree.js';
1761
+ export type {
1762
+ ScoreFactor,
1763
+ ScoreTaskContext,
1764
+ ScoreTaskInput,
1765
+ ScoreTaskResult,
1766
+ } from './tools/score-task-priority.js';
1722
1767
  // === Transport (low-level wire protocol) ===
1723
1768
  export type {
1724
1769
  AdapterTransportProvider,
@@ -0,0 +1,117 @@
1
+ /**
2
+ * ProjectTools contracts — input/output types for scaffold-project,
3
+ * doctor-project, and scaffold-global SDK tools.
4
+ *
5
+ * These are pure-functional, harness-agnostic operation contracts. Each
6
+ * tool function accepts an options bag and returns a typed result envelope —
7
+ * no I/O is performed inside the contract shapes themselves.
8
+ *
9
+ * Taxonomy: Category B SDK Tool (ADR-064).
10
+ *
11
+ * @since SG-ARCH-SOLID Saga T9831 · E-CORE-TOOLS T9835 (T9835b)
12
+ */
13
+
14
+ import type { CheckResult, ScaffoldResult } from './scaffold-diagnostics.js';
15
+
16
+ // ── scaffold-project ──────────────────────────────────────────────────
17
+
18
+ /**
19
+ * Options for {@link ScaffoldProjectResult} — controls idempotency and override.
20
+ */
21
+ export interface ScaffoldProjectOptions {
22
+ /**
23
+ * Absolute path to the project root (directory that contains `.cleo/`).
24
+ * Defaults to `process.cwd()` if omitted.
25
+ */
26
+ projectRoot?: string;
27
+ /**
28
+ * When `true`, re-writes files even if they already exist (mirrors the
29
+ * `--force` flag in `cleo init`).
30
+ *
31
+ * @default false
32
+ */
33
+ force?: boolean;
34
+ }
35
+
36
+ /**
37
+ * Result of a {@link scaffoldProject} call.
38
+ *
39
+ * Aggregates the individual {@link ScaffoldResult} returned by each
40
+ * `ensure*` step so callers can inspect per-step outcomes without re-running
41
+ * discovery.
42
+ */
43
+ export interface ScaffoldProjectResult {
44
+ /** Absolute project root that was operated on. */
45
+ projectRoot: string;
46
+ /** Per-step results, in canonical execution order. */
47
+ steps: ScaffoldProjectStep[];
48
+ /** Whether all steps completed without an exception (individual steps may still report `repaired`). */
49
+ success: boolean;
50
+ /** Aggregated human-readable summary (e.g. "3 created, 8 skipped"). */
51
+ summary: string;
52
+ }
53
+
54
+ /**
55
+ * One step within a {@link ScaffoldProjectResult}.
56
+ */
57
+ export interface ScaffoldProjectStep {
58
+ /** Stable step name used in diagnostics (e.g. `"cleo-structure"`, `"config"`). */
59
+ name: string;
60
+ /** Outcome of the corresponding `ensure*` call. Absent when the step was skipped due to an error. */
61
+ result?: ScaffoldResult;
62
+ /** Non-null when the step threw an exception (logged but not fatal). */
63
+ error?: string;
64
+ }
65
+
66
+ // ── doctor-project ────────────────────────────────────────────────────
67
+
68
+ /**
69
+ * Options for {@link doctorProject}.
70
+ */
71
+ export interface DoctorProjectOptions {
72
+ /**
73
+ * Absolute path to the project root.
74
+ * Defaults to `process.cwd()` if omitted.
75
+ */
76
+ projectRoot?: string;
77
+ /**
78
+ * Override the global cleo home used for CLI-level checks.
79
+ * Defaults to `getCleoHome()` if omitted.
80
+ */
81
+ cleoHome?: string;
82
+ }
83
+
84
+ /**
85
+ * Result of a {@link doctorProject} call — aggregates all synchronous
86
+ * diagnostic checks into a flat list.
87
+ */
88
+ export interface DoctorProjectResult {
89
+ /** Absolute project root that was inspected. */
90
+ projectRoot: string;
91
+ /** Flat list of all check outcomes, global + project-scoped. */
92
+ checks: CheckResult[];
93
+ /**
94
+ * Rolled-up exit-code style status:
95
+ * - `0` — all checks passed
96
+ * - `50` — at least one warning, no failures
97
+ * - `52` — at least one failure
98
+ */
99
+ exitCode: 0 | 50 | 52;
100
+ }
101
+
102
+ // ── scaffold-global ───────────────────────────────────────────────────
103
+
104
+ /**
105
+ * Result of a {@link scaffoldGlobal} call — mirrors the return shape of
106
+ * the underlying `ensureGlobalScaffold()` call with added provenance.
107
+ */
108
+ export interface ScaffoldGlobalResult {
109
+ /** Outcome of `ensureGlobalHome()`. */
110
+ home: ScaffoldResult;
111
+ /** Outcome of `ensureGlobalTemplates()`. */
112
+ templates: ScaffoldResult;
113
+ /** Outcome of `ensureCleoOsHub()`. */
114
+ cleoosHub: ScaffoldResult;
115
+ /** Whether all three steps completed without throwing. */
116
+ success: boolean;
117
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Contract types for the fetchBrainEntries SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional wrapper
5
+ * @task T10070
6
+ * @epic T9835
7
+ */
8
+
9
+ import type { FetchBrainEntriesParams, FetchBrainEntriesResult } from '../memory/fetch.js';
10
+
11
+ export type { FetchBrainEntriesParams, FetchBrainEntriesResult };
12
+
13
+ /** Input accepted by the fetchBrainEntries SDK tool. */
14
+ export interface FetchBrainEntriesInput {
15
+ /** Project root directory for DB resolution. */
16
+ projectRoot: string;
17
+ /** Fetch parameters forwarded to fetchBrainEntries. */
18
+ params: FetchBrainEntriesParams;
19
+ }
20
+
21
+ /** Output produced by the fetchBrainEntries SDK tool. */
22
+ export interface FetchBrainEntriesOutput {
23
+ /** Result from fetchBrainEntries. */
24
+ result: FetchBrainEntriesResult;
25
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Contract types for the observeBrain SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional wrapper
5
+ * @task T10070
6
+ * @epic T9835
7
+ */
8
+
9
+ import type { ObserveBrainParams, ObserveBrainResult } from '../memory/observe.js';
10
+
11
+ export type { ObserveBrainParams, ObserveBrainResult };
12
+
13
+ /** Input accepted by the observeBrain SDK tool. */
14
+ export interface ObserveBrainInput {
15
+ /** Project root directory for DB resolution. */
16
+ projectRoot: string;
17
+ /** Observation data forwarded to observeBrain. */
18
+ params: ObserveBrainParams;
19
+ }
20
+
21
+ /** Output produced by the observeBrain SDK tool. */
22
+ export interface ObserveBrainOutput {
23
+ /** Result from observeBrain. */
24
+ result: ObserveBrainResult;
25
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Contract types for the searchBrain SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional wrapper
5
+ * @task T10070
6
+ * @epic T9835
7
+ */
8
+
9
+ import type { SearchBrainCompactParams, SearchBrainCompactResult } from '../memory/search.js';
10
+
11
+ export type { SearchBrainCompactParams, SearchBrainCompactResult };
12
+
13
+ /** Input accepted by the searchBrain SDK tool. */
14
+ export interface SearchBrainInput {
15
+ /** Project root directory for DB resolution. */
16
+ projectRoot: string;
17
+ /** Search parameters forwarded to searchBrainCompact. */
18
+ params: SearchBrainCompactParams;
19
+ }
20
+
21
+ /** Output produced by the searchBrain SDK tool. */
22
+ export interface SearchBrainOutput {
23
+ /** Compact search results from searchBrainCompact. */
24
+ result: SearchBrainCompactResult;
25
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Contract types for the timelineBrain SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional wrapper
5
+ * @task T10070
6
+ * @epic T9835
7
+ */
8
+
9
+ import type { TimelineBrainParams, TimelineBrainResult } from '../memory/timeline.js';
10
+
11
+ export type { TimelineBrainParams, TimelineBrainResult };
12
+
13
+ /** Input accepted by the timelineBrain SDK tool. */
14
+ export interface TimelineBrainInput {
15
+ /** Project root directory for DB resolution. */
16
+ projectRoot: string;
17
+ /** Timeline parameters forwarded to timelineBrain. */
18
+ params: TimelineBrainParams;
19
+ }
20
+
21
+ /** Output produced by the timelineBrain SDK tool. */
22
+ export interface TimelineBrainOutput {
23
+ /** Result from timelineBrain. */
24
+ result: TimelineBrainResult;
25
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Contract types for the buildRetrievalBundle SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional wrapper
5
+ * @task T10070
6
+ * @epic T9835
7
+ */
8
+
9
+ import type { RetrievalBundle, RetrievalRequest } from '../operations/memory.js';
10
+
11
+ export type { RetrievalBundle, RetrievalRequest };
12
+
13
+ /** Input accepted by the buildRetrievalBundle SDK tool. */
14
+ export interface BuildRetrievalBundleInput {
15
+ /** Retrieval request forwarded to buildRetrievalBundle. */
16
+ req: RetrievalRequest;
17
+ /** Project root directory for DB resolution. */
18
+ projectRoot: string;
19
+ }
20
+
21
+ /** Output produced by the buildRetrievalBundle SDK tool. */
22
+ export interface BuildRetrievalBundleOutput {
23
+ /** Fully-structured retrieval bundle with token accounting. */
24
+ bundle: RetrievalBundle;
25
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Contract types for the buildTaskTree SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional
5
+ * @task T10068
6
+ * @epic T9835
7
+ */
8
+
9
+ import type { TaskPriority } from '../task.js';
10
+ import type { TaskTreeNode } from '../tasks.js';
11
+
12
+ export type { TaskTreeNode };
13
+
14
+ /** Minimal task shape required by buildTaskTree. */
15
+ export interface BuildTaskTreeInput {
16
+ /** Unique task identifier. */
17
+ id: string;
18
+ /** Human-readable task title. */
19
+ title: string;
20
+ /** Current task status. */
21
+ status: string;
22
+ /** Task type classification. */
23
+ type?: string;
24
+ /** Task priority level. */
25
+ priority: TaskPriority;
26
+ /** ID of the parent task (null for root). */
27
+ parentId?: string | null;
28
+ /** Sort position within sibling scope. */
29
+ position?: number | null;
30
+ /** Dependency IDs. */
31
+ depends?: string[];
32
+ /** Additional labels. */
33
+ labels?: string[];
34
+ }
35
+
36
+ /** Options for buildTaskTree. */
37
+ export interface BuildTaskTreeOptions {
38
+ /** When true, annotate each node with transitive blocker chains. */
39
+ withBlockers?: boolean;
40
+ }
41
+
42
+ /** Result of buildTaskTree. */
43
+ export interface BuildTaskTreeResult {
44
+ /** Root-level tree nodes. */
45
+ tree: TaskTreeNode[];
46
+ /** Total number of nodes across all levels. */
47
+ totalNodes: number;
48
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Contract types for the computeCriticalPath SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional
5
+ * @task T10068
6
+ * @epic T9835
7
+ */
8
+
9
+ /** A node in the dependency DAG. */
10
+ export interface CriticalPathNode {
11
+ /** Unique task identifier. */
12
+ id: string;
13
+ /** Human-readable task title. */
14
+ title: string;
15
+ /** Current task status. */
16
+ status: string;
17
+ /** Dependency IDs (scoped to the same set of nodes). */
18
+ depends: string[];
19
+ }
20
+
21
+ /** A directed edge in the dependency DAG (dependency → dependent). */
22
+ export interface CriticalPathEdge {
23
+ /** Source node ID (the dependency). */
24
+ from: string;
25
+ /** Target node ID (the dependent). */
26
+ to: string;
27
+ }
28
+
29
+ /** Result of computeCriticalPath. */
30
+ export interface CriticalPathResult {
31
+ /** Ordered task IDs from path start to end (empty when graph has cycles). */
32
+ path: string[];
33
+ /** Length of the critical path. */
34
+ length: number;
35
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Contract types for the describeSchema SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional
5
+ * @task T10071
6
+ * @epic T9835
7
+ */
8
+
9
+ /** A single column in a table descriptor. */
10
+ export interface SchemaColumn {
11
+ /** Column name as declared in the drizzle schema. */
12
+ name: string;
13
+ /** SQLite data type (e.g. "TEXT", "INTEGER", "REAL", "BLOB"). */
14
+ type: string;
15
+ /** True when the column has a NOT NULL constraint. */
16
+ notNull: boolean;
17
+ /** True when the column is part of the primary key. */
18
+ primaryKey: boolean;
19
+ }
20
+
21
+ /** A single index in a table descriptor. */
22
+ export interface SchemaIndex {
23
+ /** Index name as declared in the drizzle schema. */
24
+ name: string;
25
+ /** True when the index enforces uniqueness. */
26
+ unique: boolean;
27
+ }
28
+
29
+ /** Descriptor for one database table. */
30
+ export interface SchemaTableDescriptor {
31
+ /** Table name as stored in SQLite (snake_case). */
32
+ name: string;
33
+ /** Ordered list of column descriptors. */
34
+ columns: SchemaColumn[];
35
+ /** List of indexes defined on this table (may be empty). */
36
+ indexes: SchemaIndex[];
37
+ }
38
+
39
+ /** Full output of describeSchema — all tables in the drizzle schema. */
40
+ export interface SchemaDescriptor {
41
+ /** One entry per drizzle table exported from the schema barrel. */
42
+ tables: SchemaTableDescriptor[];
43
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * SDK Tool contract types.
3
+ *
4
+ * @arch Contracts barrel for Category B SDK Tools in packages/core/src/tools/
5
+ * @task T10068
6
+ * @task T10070
7
+ * @epic T9835
8
+ */
9
+
10
+ export type { FetchBrainEntriesInput, FetchBrainEntriesOutput } from './brain-fetch.js';
11
+ export type { ObserveBrainInput, ObserveBrainOutput } from './brain-observe.js';
12
+ // === BrainTools (T10070 / T9835c) ===
13
+ export type { SearchBrainInput, SearchBrainOutput } from './brain-search.js';
14
+ export type { TimelineBrainInput, TimelineBrainOutput } from './brain-timeline.js';
15
+ export type {
16
+ BuildRetrievalBundleInput,
17
+ BuildRetrievalBundleOutput,
18
+ } from './build-retrieval-bundle.js';
19
+
20
+ // === TaskTools (T10068 / T9835b) ===
21
+ export type {
22
+ BuildTaskTreeInput,
23
+ BuildTaskTreeOptions,
24
+ BuildTaskTreeResult,
25
+ } from './build-task-tree.js';
26
+ export type {
27
+ CriticalPathEdge,
28
+ CriticalPathNode,
29
+ CriticalPathResult,
30
+ } from './compute-critical-path.js';
31
+ export type {
32
+ SchemaColumn,
33
+ SchemaDescriptor,
34
+ SchemaIndex,
35
+ SchemaTableDescriptor,
36
+ } from './describe-schema.js';
37
+ export type { RenderTaskTreeInput } from './render-task-tree.js';
38
+ export type {
39
+ ScoreFactor,
40
+ ScoreTaskContext,
41
+ ScoreTaskInput,
42
+ ScoreTaskResult,
43
+ } from './score-task-priority.js';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Contract types for the renderTaskTree SDK tools.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional
5
+ * @task T10068
6
+ * @epic T9835
7
+ */
8
+
9
+ import type { CriticalPathEdge, CriticalPathNode } from './compute-critical-path.js';
10
+
11
+ /** Input to both text and Mermaid renderers. */
12
+ export interface RenderTaskTreeInput {
13
+ /** Task nodes to render. */
14
+ nodes: CriticalPathNode[];
15
+ /** Directed edges between nodes. */
16
+ edges: CriticalPathEdge[];
17
+ /** Task IDs on the critical path (highlighted in output). */
18
+ criticalPath: string[];
19
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Contract types for the scoreTask SDK tool.
3
+ *
4
+ * @arch SDK Tool (Category B) — harness-agnostic, pure-functional
5
+ * @task T10068
6
+ * @epic T9835
7
+ */
8
+
9
+ import type { TaskPriority } from '../task.js';
10
+
11
+ /** Minimal task shape required by scoreTask. */
12
+ export interface ScoreTaskInput {
13
+ /** Unique task identifier. */
14
+ id: string;
15
+ /** Human-readable task title. */
16
+ title: string;
17
+ /** Task priority level. */
18
+ priority: TaskPriority;
19
+ /** Phase slug this task belongs to. */
20
+ phase?: string;
21
+ /** Dependency IDs. */
22
+ depends?: string[];
23
+ /** ISO timestamp of task creation. */
24
+ createdAt?: string;
25
+ /** Labels for pattern matching. */
26
+ labels?: string[];
27
+ }
28
+
29
+ /** Context provided to scoreTask to enable phase-aware and dependency-aware scoring. */
30
+ export interface ScoreTaskContext {
31
+ /** Current project phase slug (used for phase alignment bonus). */
32
+ currentPhase?: string | null;
33
+ /** Map of all task IDs to their statuses (used for dep readiness check). */
34
+ taskStatuses?: Map<string, string>;
35
+ /** Current timestamp (ms since epoch) — defaults to Date.now() when omitted. */
36
+ nowMs?: number;
37
+ /** Matched success patterns from BRAIN (optional bonus scoring). */
38
+ successPatterns?: Array<{ pattern: string }>;
39
+ /** Matched failure patterns from BRAIN (optional penalty scoring). */
40
+ failurePatterns?: Array<{ pattern: string }>;
41
+ }
42
+
43
+ /** A scoring factor contributing to the final score. */
44
+ export interface ScoreFactor {
45
+ /** Factor name (e.g. "priority", "phaseAlignment"). */
46
+ name: string;
47
+ /** Numeric contribution (positive = bonus, negative = penalty). */
48
+ delta: number;
49
+ /** Human-readable explanation. */
50
+ detail: string;
51
+ }
52
+
53
+ /** Result of scoreTask. */
54
+ export interface ScoreTaskResult {
55
+ /** Final computed score. */
56
+ score: number;
57
+ /** Individual scoring factors. */
58
+ factors: ScoreFactor[];
59
+ }