@cat-factory/contracts 0.276.0 → 0.277.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.
- package/dist/agent-presentation.d.ts +12 -0
- package/dist/agent-presentation.d.ts.map +1 -1
- package/dist/agent-presentation.js +15 -0
- package/dist/agent-presentation.js.map +1 -1
- package/dist/pipeline-purpose.d.ts +37 -6
- package/dist/pipeline-purpose.d.ts.map +1 -1
- package/dist/pipeline-purpose.js +106 -10
- package/dist/pipeline-purpose.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,18 @@ import * as v from 'valibot';
|
|
|
2
2
|
/** The palette section an agent groups under. Mirrors the frontend `AGENT_CATEGORIES`. */
|
|
3
3
|
export declare const agentCategorySchema: v.PicklistSchema<["review", "design", "build", "test", "docs", "gates"], undefined>;
|
|
4
4
|
export type AgentCategory = v.InferOutput<typeof agentCategorySchema>;
|
|
5
|
+
/**
|
|
6
|
+
* Whether a value is a category THIS BUILD knows, DERIVED from the picklist so it cannot drift
|
|
7
|
+
* from it the way a hand-written second list would.
|
|
8
|
+
*
|
|
9
|
+
* The vocabulary is closed, but the values reaching a reader are not this build's alone: a
|
|
10
|
+
* `presentation.category` arrives in the workspace snapshot from a kind a DEPLOYMENT registered,
|
|
11
|
+
* and a category retired from the union goes on living in stored pipelines. A reader that maps one
|
|
12
|
+
* through an exhaustive `Record` is therefore total against the TYPE and partial against the DATA,
|
|
13
|
+
* which is the gap where the lookup returns `undefined` and whatever reads it renders a blank or
|
|
14
|
+
* throws. Narrow with this first and state the negative case as the unknown it is.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isAgentCategory(value: string): value is AgentCategory;
|
|
5
17
|
/**
|
|
6
18
|
* The agent tiers, WIDEST LAST. The order is load-bearing: {@link agentTierVisibleAt}
|
|
7
19
|
* compares positions in this array, so a level includes every tier at or before it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-presentation.d.ts","sourceRoot":"","sources":["../src/agent-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAY5B,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,qFAO9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"agent-presentation.d.ts","sourceRoot":"","sources":["../src/agent-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAY5B,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,qFAO9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAIrE;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,aAAa,CAErE;AAaD;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,YAAI,OAAO,EAAE,cAAc,EAAE,UAAU,CAAU,CAAA;AACzE,eAAO,MAAM,eAAe,6EAA0B,CAAA;AACtD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAA0B,CAAA;AAE3D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAEhG;AAED,4EAA4E;AAC5E,eAAO,MAAM,uBAAuB;IAClC,4CAA4C;;IAE5C,2CAA2C;;IAE3C,uCAAuC;;IAEvC;;;;;OAKG;;IAEH,gGAAgG;;IAEhG;;;;;OAKG;;IAEH;;;;;;;;OAQG;;aAEH,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;6DAC6D;AAC7D,eAAO,MAAM,qBAAqB;;;QArChC,4CAA4C;;QAE5C,2CAA2C;;QAE3C,uCAAuC;;QAEvC;;;;;WAKG;;QAEH,gGAAgG;;QAEhG;;;;;WAKG;;QAEH;;;;;;;;WAQG;;;IAUH,oEAAoE;;IAEpE;;;;;;;;;;;;;;OAcG;;IAEH;;;;;;;;;;;;;;OAcG;;aAEH,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;aAKjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
|
|
@@ -17,6 +17,21 @@ export const agentCategorySchema = v.picklist([
|
|
|
17
17
|
'docs',
|
|
18
18
|
'gates',
|
|
19
19
|
]);
|
|
20
|
+
const AGENT_CATEGORY_SET = new Set(agentCategorySchema.options);
|
|
21
|
+
/**
|
|
22
|
+
* Whether a value is a category THIS BUILD knows, DERIVED from the picklist so it cannot drift
|
|
23
|
+
* from it the way a hand-written second list would.
|
|
24
|
+
*
|
|
25
|
+
* The vocabulary is closed, but the values reaching a reader are not this build's alone: a
|
|
26
|
+
* `presentation.category` arrives in the workspace snapshot from a kind a DEPLOYMENT registered,
|
|
27
|
+
* and a category retired from the union goes on living in stored pipelines. A reader that maps one
|
|
28
|
+
* through an exhaustive `Record` is therefore total against the TYPE and partial against the DATA,
|
|
29
|
+
* which is the gap where the lookup returns `undefined` and whatever reads it renders a blank or
|
|
30
|
+
* throws. Narrow with this first and state the negative case as the unknown it is.
|
|
31
|
+
*/
|
|
32
|
+
export function isAgentCategory(value) {
|
|
33
|
+
return AGENT_CATEGORY_SET.has(value);
|
|
34
|
+
}
|
|
20
35
|
// ---------------------------------------------------------------------------
|
|
21
36
|
// Agent TIER — how specialist a kind is, in three cumulative levels. Orthogonal to
|
|
22
37
|
// `category` (which section a kind groups under) and to the interface mode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-presentation.js","sourceRoot":"","sources":["../src/agent-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,8EAA8E;AAC9E,gFAAgF;AAChF,qFAAqF;AACrF,uFAAuF;AACvF,sFAAsF;AACtF,mFAAmF;AACnF,8EAA8E;AAE9E,0FAA0F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,QAAQ,CAAC;IAC5C,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAGF,8EAA8E;AAC9E,mFAAmF;AACnF,2EAA2E;AAC3E,mFAAmF;AACnF,sEAAsE;AACtE,EAAE;AACF,oFAAoF;AACpF,mFAAmF;AACnF,6DAA6D;AAC7D,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,UAAU,CAAU,CAAA;AACzE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;AAGtD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAc,cAAc,CAAA;AAE3D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAkC,EAAE,KAAgB;IACrF,OAAO,WAAW,CAAC,OAAO,CAAC,IAAI,IAAI,kBAAkB,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AACtF,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC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,CAAC;CACpC,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
-
import type
|
|
2
|
+
import { type AgentCategory } from './agent-presentation.js';
|
|
3
3
|
import type { Pipeline } from './entities.js';
|
|
4
4
|
import type { BlockLevel, TaskType } from './primitives.js';
|
|
5
5
|
/**
|
|
@@ -16,19 +16,50 @@ import type { BlockLevel, TaskType } from './primitives.js';
|
|
|
16
16
|
* - `planning` — decomposes and plans an initiative (no code, no repo write of its own).
|
|
17
17
|
*
|
|
18
18
|
* A non-`build` purpose hides the Implementation/Testing agent kinds in the builder
|
|
19
|
-
* ({@link purposeAllowsAgentCategory})
|
|
19
|
+
* ({@link purposeAllowsAgentCategory}), narrows what its palette offers
|
|
20
|
+
* ({@link purposeSuggestsAgentCategory}) and scopes the pipeline in the task pickers
|
|
20
21
|
* ({@link pipelineAllowedForTaskType}). The `Pipeline.purpose` field references this schema.
|
|
21
22
|
*/
|
|
22
23
|
export declare const PIPELINE_PURPOSES: readonly ['build', 'document', 'review', 'research', 'planning'];
|
|
23
24
|
export declare const pipelinePurposeSchema: v.PicklistSchema<readonly ["build", "document", "review", "research", "planning"], undefined>;
|
|
24
25
|
export type PipelinePurpose = v.InferOutput<typeof pipelinePurposeSchema>;
|
|
25
26
|
/**
|
|
26
|
-
* Whether a
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* Whether a value is a purpose THIS BUILD knows, DERIVED from the picklist for the same reason
|
|
28
|
+
* {@link isAgentCategory} is: the vocabulary is closed but PERSISTED, on `Pipeline.purpose`, so a
|
|
29
|
+
* member retired from the union goes on living in stored rows and in the SPA bundle a browser
|
|
30
|
+
* cached before a new member shipped. Narrow with this before indexing anything by a purpose.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isPipelinePurpose(value: string): value is PipelinePurpose;
|
|
33
|
+
/**
|
|
34
|
+
* Whether a pipeline of `purpose` may use an agent kind in `category`: the builder's SAVE
|
|
35
|
+
* gate. A `build` (or unclassified) pipeline may use anything; every other purpose refuses the
|
|
36
|
+
* Implementation (`build`) and Testing (`test`) categories, the two that contradict the
|
|
37
|
+
* classifier outright. Uncategorized kinds (no `category`) are always allowed, the caller
|
|
38
|
+
* showing them regardless.
|
|
39
|
+
*
|
|
40
|
+
* For what the palette OFFERS, see {@link purposeSuggestsAgentCategory}: it narrows further,
|
|
41
|
+
* and the difference is what keeps a stored pipeline editable after this file gets an opinion
|
|
42
|
+
* it did not have when that pipeline was built. A purpose this build does not RECOGNISE is the
|
|
43
|
+
* limit case of the same rule ({@link classifierFor}), and refusing there would be the worst
|
|
44
|
+
* version of it: a save blocked over a classifier the editor cannot even name.
|
|
30
45
|
*/
|
|
31
46
|
export declare function purposeAllowsAgentCategory(purpose: Pipeline['purpose'] | null | undefined, category: AgentCategory): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether an agent kind in `category` is worth OFFERING to a pipeline of `purpose`: the
|
|
49
|
+
* builder palette's filter, sitting beside the agent-tier dial on the same control row.
|
|
50
|
+
*
|
|
51
|
+
* Unclassified (absent or unrecognised `purpose`, see {@link classifierFor}) offers everything,
|
|
52
|
+
* for the same reason it saves everything: a pipeline nobody classified has told us nothing to
|
|
53
|
+
* narrow by. A category this build does not recognise is offered for the mirror reason: the
|
|
54
|
+
* table has no cell to read for it, and the honest reading of a missing cell is that a kind a
|
|
55
|
+
* deployment registered stays visible in the palette, rather than vanishing from a catalog whose
|
|
56
|
+
* save gate would have accepted it.
|
|
57
|
+
*
|
|
58
|
+
* Both narrowings are DEFAULT-OPEN on an unknown value, and deliberately: the compile-time guard
|
|
59
|
+
* (the doubly-exhaustive table below) is what forces a decision for every member this build has,
|
|
60
|
+
* and the runtime one exists only for the values it structurally cannot have.
|
|
61
|
+
*/
|
|
62
|
+
export declare function purposeSuggestsAgentCategory(purpose: Pipeline['purpose'] | null | undefined, category: AgentCategory): boolean;
|
|
32
63
|
/**
|
|
33
64
|
* Whether `pipeline` should be offered when starting a task of `taskType` — the pickers' gate.
|
|
34
65
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-purpose.d.ts","sourceRoot":"","sources":["../src/pipeline-purpose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pipeline-purpose.d.ts","sourceRoot":"","sources":["../src/pipeline-purpose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,yBAAyB,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,YAAI,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAU,CAAA;AACjG,eAAO,MAAM,qBAAqB,+FAAgC,CAAA;AAClE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAIzE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,eAAe,CAEzE;AAqDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,EAC/C,QAAQ,EAAE,aAAa,GACtB,OAAO,CAIT;AA8BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,EAC/C,QAAQ,EAAE,aAAa,GACtB,OAAO,CAIT;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,EACnC,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAC7B,OAAO,CAOT;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,EACnC,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,OAAO,CAIT"}
|
package/dist/pipeline-purpose.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
|
+
import { isAgentCategory } from './agent-presentation.js';
|
|
2
3
|
/**
|
|
3
4
|
* The USE-CASE of a pipeline — what kind of work it exists to do. Chosen in the pipeline
|
|
4
5
|
* builder and stamped on every built-in preset, it is the classifier the SPA filters on:
|
|
@@ -13,39 +14,134 @@ import * as v from 'valibot';
|
|
|
13
14
|
* - `planning` — decomposes and plans an initiative (no code, no repo write of its own).
|
|
14
15
|
*
|
|
15
16
|
* A non-`build` purpose hides the Implementation/Testing agent kinds in the builder
|
|
16
|
-
* ({@link purposeAllowsAgentCategory})
|
|
17
|
+
* ({@link purposeAllowsAgentCategory}), narrows what its palette offers
|
|
18
|
+
* ({@link purposeSuggestsAgentCategory}) and scopes the pipeline in the task pickers
|
|
17
19
|
* ({@link pipelineAllowedForTaskType}). The `Pipeline.purpose` field references this schema.
|
|
18
20
|
*/
|
|
19
21
|
export const PIPELINE_PURPOSES = ['build', 'document', 'review', 'research', 'planning'];
|
|
20
22
|
export const pipelinePurposeSchema = v.picklist(PIPELINE_PURPOSES);
|
|
23
|
+
const PIPELINE_PURPOSE_SET = new Set(pipelinePurposeSchema.options);
|
|
24
|
+
/**
|
|
25
|
+
* Whether a value is a purpose THIS BUILD knows, DERIVED from the picklist for the same reason
|
|
26
|
+
* {@link isAgentCategory} is: the vocabulary is closed but PERSISTED, on `Pipeline.purpose`, so a
|
|
27
|
+
* member retired from the union goes on living in stored rows and in the SPA bundle a browser
|
|
28
|
+
* cached before a new member shipped. Narrow with this before indexing anything by a purpose.
|
|
29
|
+
*/
|
|
30
|
+
export function isPipelinePurpose(value) {
|
|
31
|
+
return PIPELINE_PURPOSE_SET.has(value);
|
|
32
|
+
}
|
|
21
33
|
// ---------------------------------------------------------------------------
|
|
22
34
|
// Pipeline-purpose gating (shared by the SPA pickers + the builder palette).
|
|
23
35
|
//
|
|
24
36
|
// A pipeline's `purpose` (see `PIPELINE_PURPOSES` in entities) is its use-case
|
|
25
|
-
// classifier
|
|
26
|
-
// key off it, and
|
|
37
|
+
// classifier, set in the builder and stamped on every built-in preset. Three surfaces
|
|
38
|
+
// key off it, and all share these pure predicates so they can't drift:
|
|
27
39
|
// - the task pickers: a `document` task authors a document, so it is offered ONLY
|
|
28
40
|
// `purpose: 'document'` pipelines (a build/test pipeline makes no sense for it);
|
|
29
|
-
// - the builder palette
|
|
30
|
-
//
|
|
41
|
+
// - the builder palette, which offers only the categories the purpose makes sense of
|
|
42
|
+
// ({@link purposeSuggestsAgentCategory});
|
|
43
|
+
// - the builder's save gate, which refuses a draft holding a step the purpose is
|
|
44
|
+
// INCOMPATIBLE with ({@link purposeAllowsAgentCategory}).
|
|
45
|
+
//
|
|
46
|
+
// The last two are deliberately different questions. RELEVANCE narrows a catalog of ~30
|
|
47
|
+
// kinds to the ones worth offering, and is free to be opinionated because a wrong guess
|
|
48
|
+
// costs one purpose switch. COMPATIBILITY blocks a save, so it states only what is
|
|
49
|
+
// actually contradictory (a pipeline that writes no code carrying an implementation
|
|
50
|
+
// step), or tightening the relevance table would make somebody's stored pipeline
|
|
51
|
+
// unsaveable in the editor it was built in. Relevance is a SUBSET of compatibility
|
|
52
|
+
// (asserted in the tests): the palette may hide what the save gate tolerates, never the
|
|
53
|
+
// reverse, which would offer a kind that cannot then be saved.
|
|
31
54
|
//
|
|
32
55
|
// An absent `purpose` means UNCLASSIFIED (a legacy/custom pipeline never given one):
|
|
33
56
|
// treated as `build` for the palette (unrestricted) and hidden from a `document` task
|
|
34
57
|
// (which requires the explicit classifier), rather than silently narrowing everything.
|
|
58
|
+
//
|
|
59
|
+
// Both narrowing predicates take a value that is TYPED as a member and only DECLARED to be
|
|
60
|
+
// one. See {@link classifierFor} for what an unrecognised value means and why.
|
|
35
61
|
// ---------------------------------------------------------------------------
|
|
36
62
|
/** The agent-palette categories hidden from a non-`build` pipeline (writes no code, runs no tests). */
|
|
37
63
|
const NON_BUILD_HIDDEN_CATEGORIES = ['build', 'test'];
|
|
38
64
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
65
|
+
* The purpose to narrow BY, or `null` for "this build has nothing to narrow by".
|
|
66
|
+
*
|
|
67
|
+
* Absent and UNRECOGNISED collapse to the same answer, and stating that once is the point of the
|
|
68
|
+
* helper. Both predicates are typed against `PipelinePurpose`, but the value reaching them is a
|
|
69
|
+
* stored `Pipeline.purpose` that no boundary re-checks against the union THIS build compiled: a
|
|
70
|
+
* browser holding a cached bundle sees a member shipped after it, and a member retired from the
|
|
71
|
+
* union goes on living in saved rows. Neither is a value to guess a current member from.
|
|
72
|
+
*
|
|
73
|
+
* The two predicates must agree about that, not merely each handle it: relevance is a SUBSET of
|
|
74
|
+
* compatibility, so a purpose the palette stops narrowing by while the save gate keeps narrowing
|
|
75
|
+
* by it would offer exactly the kind whose step then blocks the save. Reading through one helper
|
|
76
|
+
* is what keeps them from drifting into opposite readings of the same unknown value.
|
|
77
|
+
*/
|
|
78
|
+
function classifierFor(purpose) {
|
|
79
|
+
return purpose && isPipelinePurpose(purpose) ? purpose : null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Whether a pipeline of `purpose` may use an agent kind in `category`: the builder's SAVE
|
|
83
|
+
* gate. A `build` (or unclassified) pipeline may use anything; every other purpose refuses the
|
|
84
|
+
* Implementation (`build`) and Testing (`test`) categories, the two that contradict the
|
|
85
|
+
* classifier outright. Uncategorized kinds (no `category`) are always allowed, the caller
|
|
86
|
+
* showing them regardless.
|
|
87
|
+
*
|
|
88
|
+
* For what the palette OFFERS, see {@link purposeSuggestsAgentCategory}: it narrows further,
|
|
89
|
+
* and the difference is what keeps a stored pipeline editable after this file gets an opinion
|
|
90
|
+
* it did not have when that pipeline was built. A purpose this build does not RECOGNISE is the
|
|
91
|
+
* limit case of the same rule ({@link classifierFor}), and refusing there would be the worst
|
|
92
|
+
* version of it: a save blocked over a classifier the editor cannot even name.
|
|
43
93
|
*/
|
|
44
94
|
export function purposeAllowsAgentCategory(purpose, category) {
|
|
45
|
-
|
|
95
|
+
const classifier = classifierFor(purpose);
|
|
96
|
+
if (classifier === null || classifier === 'build')
|
|
46
97
|
return true;
|
|
47
98
|
return !NON_BUILD_HIDDEN_CATEGORIES.includes(category);
|
|
48
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Which palette categories each purpose is worth offering. A doubly-exhaustive `Record`
|
|
102
|
+
* rather than a per-purpose deny list: adding a purpose OR an {@link AgentCategory} fails to
|
|
103
|
+
* compile until every cell has been decided, which is the whole value of the table: the
|
|
104
|
+
* silent outcome is a new category quietly offered to every purpose, or a new purpose
|
|
105
|
+
* quietly offered the whole catalog, and neither reads as a missing decision at the call site.
|
|
106
|
+
*/
|
|
107
|
+
const PURPOSE_SUGGESTED_CATEGORIES = {
|
|
108
|
+
// Ships product code: every category is in play.
|
|
109
|
+
build: { review: true, design: true, build: true, test: true, docs: true, gates: true },
|
|
110
|
+
// Authors a document: researched, drafted, reviewed and merged like any change, but
|
|
111
|
+
// nothing is implemented or tested.
|
|
112
|
+
document: { review: true, design: true, build: false, test: false, docs: true, gates: true },
|
|
113
|
+
// Reviews an EXISTING pull request and opens none: it designs nothing and builds nothing,
|
|
114
|
+
// so only the judging kinds apply. `docs` stays because the Domain Rules Reviewer is a
|
|
115
|
+
// review activity that groups under Documentation.
|
|
116
|
+
review: { review: true, design: false, build: false, test: false, docs: true, gates: true },
|
|
117
|
+
// Timeboxed investigation: the design kinds (spike, researcher, brainstorms) do the work
|
|
118
|
+
// and it lands as a findings document.
|
|
119
|
+
research: { review: true, design: true, build: false, test: false, docs: true, gates: true },
|
|
120
|
+
// Decomposes an initiative: no code, no repo documentation of its own (the plan is the
|
|
121
|
+
// in-repo tracker its own steps commit) and no pull request, so nothing to gate either.
|
|
122
|
+
planning: { review: true, design: true, build: false, test: false, docs: false, gates: false },
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Whether an agent kind in `category` is worth OFFERING to a pipeline of `purpose`: the
|
|
126
|
+
* builder palette's filter, sitting beside the agent-tier dial on the same control row.
|
|
127
|
+
*
|
|
128
|
+
* Unclassified (absent or unrecognised `purpose`, see {@link classifierFor}) offers everything,
|
|
129
|
+
* for the same reason it saves everything: a pipeline nobody classified has told us nothing to
|
|
130
|
+
* narrow by. A category this build does not recognise is offered for the mirror reason: the
|
|
131
|
+
* table has no cell to read for it, and the honest reading of a missing cell is that a kind a
|
|
132
|
+
* deployment registered stays visible in the palette, rather than vanishing from a catalog whose
|
|
133
|
+
* save gate would have accepted it.
|
|
134
|
+
*
|
|
135
|
+
* Both narrowings are DEFAULT-OPEN on an unknown value, and deliberately: the compile-time guard
|
|
136
|
+
* (the doubly-exhaustive table below) is what forces a decision for every member this build has,
|
|
137
|
+
* and the runtime one exists only for the values it structurally cannot have.
|
|
138
|
+
*/
|
|
139
|
+
export function purposeSuggestsAgentCategory(purpose, category) {
|
|
140
|
+
const classifier = classifierFor(purpose);
|
|
141
|
+
if (classifier === null || !isAgentCategory(category))
|
|
142
|
+
return true;
|
|
143
|
+
return PURPOSE_SUGGESTED_CATEGORIES[classifier][category];
|
|
144
|
+
}
|
|
49
145
|
/**
|
|
50
146
|
* The purposes a PROGRAMMATIC task (`feature` / `bug`) may be offered. It ships code, so a
|
|
51
147
|
* `document` or `review` pipeline is meaningless for it — the reverse of the narrowing those task
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-purpose.js","sourceRoot":"","sources":["../src/pipeline-purpose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"pipeline-purpose.js","sourceRoot":"","sources":["../src/pipeline-purpose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAsB,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAI7E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAU,CAAA;AACjG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAA;AAGlE,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAA;AAExF;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACxC,CAAC;AAED,8EAA8E;AAC9E,6EAA6E;AAC7E,EAAE;AACF,+EAA+E;AAC/E,sFAAsF;AACtF,uEAAuE;AACvE,oFAAoF;AACpF,qFAAqF;AACrF,uFAAuF;AACvF,8CAA8C;AAC9C,mFAAmF;AACnF,8DAA8D;AAC9D,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,mFAAmF;AACnF,oFAAoF;AACpF,iFAAiF;AACjF,mFAAmF;AACnF,wFAAwF;AACxF,+DAA+D;AAC/D,EAAE;AACF,qFAAqF;AACrF,sFAAsF;AACtF,uFAAuF;AACvF,EAAE;AACF,2FAA2F;AAC3F,+EAA+E;AAC/E,8EAA8E;AAE9E,uGAAuG;AACvG,MAAM,2BAA2B,GAA6B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAE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