wicked-crew 0.6.0 → 0.7.0

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 (99) hide show
  1. package/dist/api/audit.d.ts +13 -0
  2. package/dist/api/audit.d.ts.map +1 -1
  3. package/dist/api/audit.js +18 -2
  4. package/dist/api/audit.js.map +1 -1
  5. package/dist/api/guidance-index.d.ts +39 -0
  6. package/dist/api/guidance-index.d.ts.map +1 -0
  7. package/dist/api/guidance-index.js +67 -0
  8. package/dist/api/guidance-index.js.map +1 -0
  9. package/dist/api/open-path.d.ts +16 -0
  10. package/dist/api/open-path.d.ts.map +1 -1
  11. package/dist/api/open-path.js +22 -0
  12. package/dist/api/open-path.js.map +1 -1
  13. package/dist/api/retry-index.d.ts +30 -0
  14. package/dist/api/retry-index.d.ts.map +1 -0
  15. package/dist/api/retry-index.js +45 -0
  16. package/dist/api/retry-index.js.map +1 -0
  17. package/dist/api/routes.d.ts +53 -1
  18. package/dist/api/routes.d.ts.map +1 -1
  19. package/dist/api/routes.js +352 -23
  20. package/dist/api/routes.js.map +1 -1
  21. package/dist/api/run-files.d.ts +63 -0
  22. package/dist/api/run-files.d.ts.map +1 -0
  23. package/dist/api/run-files.js +271 -0
  24. package/dist/api/run-files.js.map +1 -0
  25. package/dist/api/server.d.ts +79 -0
  26. package/dist/api/server.d.ts.map +1 -1
  27. package/dist/api/server.js +135 -6
  28. package/dist/api/server.js.map +1 -1
  29. package/dist/api/stall-watchdog.d.ts +62 -0
  30. package/dist/api/stall-watchdog.d.ts.map +1 -0
  31. package/dist/api/stall-watchdog.js +138 -0
  32. package/dist/api/stall-watchdog.js.map +1 -0
  33. package/dist/cli/index.js +78 -13
  34. package/dist/cli/index.js.map +1 -1
  35. package/dist/core/adapter.d.ts +24 -10
  36. package/dist/core/adapter.d.ts.map +1 -1
  37. package/dist/core/adapter.js +191 -30
  38. package/dist/core/adapter.js.map +1 -1
  39. package/dist/core/bridge-reaper.d.ts +134 -0
  40. package/dist/core/bridge-reaper.d.ts.map +1 -0
  41. package/dist/core/bridge-reaper.js +286 -0
  42. package/dist/core/bridge-reaper.js.map +1 -0
  43. package/dist/core/deliver.d.ts +118 -0
  44. package/dist/core/deliver.d.ts.map +1 -0
  45. package/dist/core/deliver.js +241 -0
  46. package/dist/core/deliver.js.map +1 -0
  47. package/dist/core/deliverable-floor.d.ts +103 -0
  48. package/dist/core/deliverable-floor.d.ts.map +1 -0
  49. package/dist/core/deliverable-floor.js +173 -0
  50. package/dist/core/deliverable-floor.js.map +1 -0
  51. package/dist/core/exec.d.ts +2 -0
  52. package/dist/core/exec.d.ts.map +1 -1
  53. package/dist/core/exec.js.map +1 -1
  54. package/dist/core/types.d.ts +79 -1
  55. package/dist/core/types.d.ts.map +1 -1
  56. package/dist/core/types.js +3 -0
  57. package/dist/core/types.js.map +1 -1
  58. package/dist/interactive/bridge-pool.d.ts +28 -0
  59. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  60. package/dist/interactive/bridge-pool.js +67 -10
  61. package/dist/interactive/bridge-pool.js.map +1 -1
  62. package/dist/interactive/chat-events.d.ts +207 -0
  63. package/dist/interactive/chat-events.d.ts.map +1 -0
  64. package/dist/interactive/chat-events.js +769 -0
  65. package/dist/interactive/chat-events.js.map +1 -0
  66. package/dist/interactive/demo-events.d.ts +283 -0
  67. package/dist/interactive/demo-events.d.ts.map +1 -0
  68. package/dist/interactive/demo-events.js +889 -0
  69. package/dist/interactive/demo-events.js.map +1 -0
  70. package/dist/interactive/draft-events.d.ts +87 -7
  71. package/dist/interactive/draft-events.d.ts.map +1 -1
  72. package/dist/interactive/draft-events.js +352 -49
  73. package/dist/interactive/draft-events.js.map +1 -1
  74. package/dist/interactive/edit-events.d.ts +22 -0
  75. package/dist/interactive/edit-events.d.ts.map +1 -1
  76. package/dist/interactive/edit-events.js +73 -2
  77. package/dist/interactive/edit-events.js.map +1 -1
  78. package/dist/interactive/repo-snapshot.d.ts +100 -0
  79. package/dist/interactive/repo-snapshot.d.ts.map +1 -0
  80. package/dist/interactive/repo-snapshot.js +289 -0
  81. package/dist/interactive/repo-snapshot.js.map +1 -0
  82. package/dist/projects/graph-paths.d.ts +92 -0
  83. package/dist/projects/graph-paths.d.ts.map +1 -0
  84. package/dist/projects/graph-paths.js +130 -0
  85. package/dist/projects/graph-paths.js.map +1 -0
  86. package/dist/projects/graph.d.ts +179 -0
  87. package/dist/projects/graph.d.ts.map +1 -0
  88. package/dist/projects/graph.js +775 -0
  89. package/dist/projects/graph.js.map +1 -0
  90. package/dist/projects/routes.d.ts +7 -0
  91. package/dist/projects/routes.d.ts.map +1 -1
  92. package/dist/projects/routes.js +122 -0
  93. package/dist/projects/routes.js.map +1 -1
  94. package/dist/studio/assets/index-8p8uwCxG.js +530 -0
  95. package/dist/studio/assets/index-D6S9zUtO.css +32 -0
  96. package/dist/studio/index.html +5 -3
  97. package/package.json +3 -3
  98. package/dist/studio/assets/index-CCwXa1cn.js +0 -428
  99. package/dist/studio/assets/index-HWxo0h41.css +0 -32
@@ -0,0 +1,179 @@
1
+ /**
2
+ * The project code graph — every `crew.repo` member of one project in ONE wicked-estate database.
3
+ *
4
+ * # What changed to make this possible
5
+ *
6
+ * One estate database used to hold exactly one repo. SymbolIds embed the repo-relative path, so two
7
+ * repos that both contain `src/index.ts` mint identical file rows AND identical symbol ids: the
8
+ * second index overwrote the first and said nothing. `wicked-estate index <path> --repo <label>`
9
+ * (wicked-estate#117) namespaces every path as `<label>/…`, so N repos co-exist, each queryable,
10
+ * with a guard that refuses — before a row is written — any index that would overwrite another
11
+ * repo's content.
12
+ *
13
+ * # THE LIMIT
14
+ *
15
+ * CO-LOCATION IS NOT LINKAGE. estate resolves edges within a labelled repo's own nodes, exactly as
16
+ * if each repo sat in its own database. `studio → wicked-crew-api-types → crew` does not traverse.
17
+ * What this module federates is per-repo results into one answer with the repo named on every hit —
18
+ * which is genuinely useful ("who calls `record`, anywhere in this project") and is NOT a cross-repo
19
+ * dependency trace. Every response carries `linkage: 'co-located'` and {@link CO_LOCATION_NOTE} so a
20
+ * consumer cannot mistake one for the other.
21
+ *
22
+ * # Why the estate binary is capability-PROBED before anything is indexed
23
+ *
24
+ * `wicked-estate 0.14.4` — the version installed on this machine while this was written — accepts
25
+ * `--repo`, IGNORES it, and exits 0. Indexing three repos through it produces a database holding
26
+ * only the third, with no error anywhere and results that look perfectly healthy. That is the exact
27
+ * silent-loss failure the labelling work exists to end, reachable by nothing worse than a stale
28
+ * binary on PATH. So the flag's support is established from the binary that will actually run,
29
+ * before the first index (help text), and confirmed from the database afterwards (the labelled repo
30
+ * registry `stats` prints) — a claim, then evidence.
31
+ *
32
+ * # Honest degradation
33
+ *
34
+ * Every path out of here names its cause. A project with no repo members, one whose graph was never
35
+ * built, one whose member repo the registry no longer knows, and an addon too old to publish
36
+ * `code_graph_db` are four different situations with four different remedies; collapsing them into
37
+ * an empty result set is the failure estate's own R3 rule exists to prevent, and it is the failure
38
+ * FINDING-069 actually shipped.
39
+ */
40
+ import type { CoreAdapter } from '../core/adapter.js';
41
+ import type { ProjectBlastRadius, ProjectGraphHit, ProjectGraphRefreshResult, ProjectGraphRepoCount, ProjectGraphSearch, ProjectGraphStatus } from '../core/types.js';
42
+ /** The sentence every project-graph response carries. Stated on the wire, not just in this file. */
43
+ export declare const CO_LOCATION_NOTE: string;
44
+ /**
45
+ * The second sentence `/graph/search` carries, and only it.
46
+ *
47
+ * `matches: []` from an exact-name resolver against a healthy graph is the empty-result-that-reads-
48
+ * as-an-answer this whole surface is built to refuse: a caller who typed half a name is told
49
+ * "nothing in this project", which is false. estate's `resolve` has no substring mode (the header
50
+ * on {@link projectSymbolSearch} argues why a `nodes --json` dump is not the answer), so the
51
+ * matching RULE goes on the wire instead of a matching mode that does not exist.
52
+ */
53
+ export declare const EXACT_NAME_NOTE: string;
54
+ /**
55
+ * Does the `wicked-estate` that will actually run support `--repo`?
56
+ *
57
+ * A version comparison would be the obvious probe and the wrong one: it asks a string on disk
58
+ * instead of the binary on PATH, and a locally built or vendored estate can carry any version it
59
+ * likes. The usage banner is printed by the same binary that would do the indexing.
60
+ */
61
+ export declare function estateSupportsMultiRepo(env?: NodeJS.ProcessEnv): Promise<boolean>;
62
+ /**
63
+ * The evidence check failed: the binary took `--repo` and dropped it.
64
+ *
65
+ * A distinct type because it is NOT a per-repo failure and must not be collected as one. It is the
66
+ * same fact the capability probe establishes — this binary cannot co-locate — discovered one step
67
+ * later, and the only safe response is the probe's: stop, before the next repo's index overwrites
68
+ * the rows just written. Recording it in `failed` and continuing runs a full index per member, each
69
+ * clobbering the last, while the message on every entry claims the opposite.
70
+ */
71
+ export declare class EstateDroppedRepoLabelError extends Error {
72
+ constructor(message: string);
73
+ }
74
+ /**
75
+ * Thrown when the running addon predates `code_graph_db` on the repo record. Mapped to 501: this is
76
+ * a capability gap in the engine, not a bad request.
77
+ *
78
+ * WHY this surface gates on a field it does not itself use. The project graph lives in crew's own
79
+ * state directory and is built from `root_path`, so it could be built against any addon. But
80
+ * `code_graph_db` is the engine's statement that it can vouch for where a repo's graph lives, and
81
+ * `/repos/:id/graph` HARD-THROWS without it (repoPaths.ts, deliberately — a local re-derivation is
82
+ * what FINDING-069 was). Quietly serving a project graph on a daemon whose per-repo graph surface
83
+ * cannot answer would leave two graph endpoints disagreeing about whether this repo has a graph at
84
+ * all, and the operator's real problem — a stale addon — unmentioned.
85
+ */
86
+ export declare class ProjectGraphEngineTooOldError extends Error {
87
+ readonly cause: string;
88
+ constructor(cause: string);
89
+ }
90
+ /** Read the project graph's standing without touching it. */
91
+ export declare function projectGraphStatus(adapter: CoreAdapter, projectId: string, env?: NodeJS.ProcessEnv): Promise<ProjectGraphStatus>;
92
+ export declare function refreshProjectGraph(adapter: CoreAdapter, projectId: string, env?: NodeJS.ProcessEnv): Promise<ProjectGraphRefreshResult>;
93
+ /**
94
+ * Passed to the engine as `LaunchOptions.projectGraph`. `repoLabel` names this run's repo inside
95
+ * the co-located graph so the engine can confirm the graph actually holds it; a repo-less run
96
+ * carries no label because it has no own repo to confirm.
97
+ */
98
+ export interface ProjectGraphBinding {
99
+ dbPath: string;
100
+ repoLabel?: string;
101
+ }
102
+ /**
103
+ * What a launch decided about the project graph, and why. The `reason` is carried on BOTH outcomes
104
+ * because "you got the project graph" and "you got the repo graph instead, because X" are equally
105
+ * worth saying, and the operator asking "why can't this run see the sibling repo" needs the second
106
+ * one to have been recorded somewhere.
107
+ */
108
+ export interface ProjectGraphBindingDecision {
109
+ /** The binding to hand the engine; `null` ⇒ the run keeps whatever graph it would have had. */
110
+ binding: ProjectGraphBinding | null;
111
+ /** One sentence: what the run got, and what would change it. */
112
+ reason: string;
113
+ }
114
+ /**
115
+ * Decide which code graph a run launched into `projectId` should be bound to.
116
+ *
117
+ * # This never indexes
118
+ *
119
+ * A refresh is `wicked-estate index` per member repo, bounded at ten minutes EACH. Doing that
120
+ * inside a launch would turn "start a run" into an unannounced multi-repo indexing job that blocks
121
+ * the response, and the first thing an operator would learn about it is a request that appears to
122
+ * hang. So a missing or stale graph DEGRADES the run to the per-repo graph and says so; refreshing
123
+ * stays an explicit `POST /projects/:id/graph/refresh`.
124
+ *
125
+ * # Why the run's OWN repo decides it
126
+ *
127
+ * The engine independently verifies whatever it is handed and falls back on its own, so this
128
+ * function cannot make a run unsafe — but it can make one confusing, and it has information the
129
+ * engine does not. `projectGraphStatus` knows a repo was attached after the last refresh, that its
130
+ * registry root moved out from under the label, that its member ref is dangling. Declining HERE,
131
+ * with that cause attached, is the difference between an operator reading "attached since the last
132
+ * refresh — not in the graph yet" and reading the engine's generic "no files under that label".
133
+ *
134
+ * The rule itself is the engine's, restated on this side: bind when the graph holds THIS RUN'S
135
+ * repo. A graph missing some OTHER member is still bound — it is strictly more than the per-repo
136
+ * graph, and the run's own code is described correctly. A graph missing THIS repo is not, because
137
+ * its answers about the worktree the worker is sitting in would all be "nothing found".
138
+ */
139
+ export declare function resolveProjectGraphBinding(adapter: CoreAdapter, projectId: string, repoRef: string | undefined, env?: NodeJS.ProcessEnv): Promise<ProjectGraphBindingDecision>;
140
+ /**
141
+ * A query can run only against a graph that exists and holds at least one MEMBER repo. Anything
142
+ * else is returned as the status, so the caller gets the cause and the remedy instead of `[]`.
143
+ */
144
+ export type Queryable = {
145
+ ok: true;
146
+ dbPath: string;
147
+ status: ProjectGraphStatus;
148
+ labels: Map<string, string>;
149
+ } | {
150
+ ok: false;
151
+ status: ProjectGraphStatus;
152
+ };
153
+ export declare function queryable(adapter: CoreAdapter, projectId: string, env?: NodeJS.ProcessEnv): Promise<Queryable>;
154
+ /**
155
+ * estate's raw hit list → attributed hits plus their per-repo counts. THE federation step, and the
156
+ * only place a result acquires its provenance — exported so the attribution rules are testable
157
+ * without a graph on disk, which is what makes the stale-label exclusion below coverable at all.
158
+ */
159
+ export declare function attributeHits(raw: unknown, labels: Map<string, string>): {
160
+ hits: ProjectGraphHit[];
161
+ byRepo: ProjectGraphRepoCount[];
162
+ };
163
+ /** Dependents of a symbol across every member repo, each hit attributed to the repo it is in. */
164
+ export declare function projectBlastRadius(q: Extract<Queryable, {
165
+ ok: true;
166
+ }>, name: string, env?: NodeJS.ProcessEnv): Promise<ProjectBlastRadius>;
167
+ /**
168
+ * Symbol search across every member repo — exact name, which is what estate's `resolve` answers.
169
+ *
170
+ * Not a substring search on purpose: the only estate primitive that would give one is a full
171
+ * `nodes --json` dump filtered daemon-side, whose cost scales with the whole project rather than
172
+ * with the query, and which would need a cap whose truncation is itself a silent wrong answer.
173
+ * `resolve` is the same primitive the repo-scoped surface uses to turn a name into SymbolIds; run
174
+ * against a co-located graph it returns every repo's matches in one call.
175
+ */
176
+ export declare function projectSymbolSearch(q: Extract<Queryable, {
177
+ ok: true;
178
+ }>, name: string, env?: NodeJS.ProcessEnv): Promise<ProjectGraphSearch>;
179
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/projects/graph.ts"],"names":[],"mappings":"AAAA;;;;;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