@tangle-network/agent-app 0.60.229 → 0.60.231
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/README.md +8 -0
- package/dist/chat-routes/index.js +1 -1
- package/dist/chat-routes/turn-admission.d.ts +43 -0
- package/dist/chat-routes/turn-event-stream.d.ts +31 -0
- package/dist/chat-routes/turn-execution.d.ts +23 -0
- package/dist/chat-routes/turn-route-contracts.d.ts +724 -0
- package/dist/chat-routes/turn-routes.d.ts +2 -723
- package/dist/{chunk-PTB2B2OO.js → chunk-RMPPWNW7.js} +363 -336
- package/dist/chunk-RMPPWNW7.js.map +1 -0
- package/dist/public-consultation/index.js +1 -1
- package/dist/skills-placement/index.d.ts +16 -3
- package/dist/skills-placement/index.js +11 -7
- package/dist/skills-placement/index.js.map +1 -1
- package/dist/work-product/draft-emission-tools.d.ts +5 -0
- package/dist/work-product/draft-tool-context.d.ts +19 -0
- package/dist/work-product/evidence-verification.d.ts +160 -0
- package/dist/work-product/index.js +74 -59
- package/dist/work-product/index.js.map +1 -1
- package/dist/work-product/submission-tool.d.ts +5 -0
- package/dist/work-product/tool-config.d.ts +124 -0
- package/dist/work-product/tools.d.ts +3 -125
- package/package.json +1 -1
- package/dist/chunk-PTB2B2OO.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type AppToolDefinition } from '../tools/registry';
|
|
2
|
+
import type { WorkProductService } from './service';
|
|
3
|
+
import { type WorkProductToolConfig } from './tool-config';
|
|
4
|
+
/** Register the terminal submission, preserving the ordered platform checks before ready. */
|
|
5
|
+
export declare function buildSubmissionTool(config: WorkProductToolConfig, service: WorkProductService): AppToolDefinition;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { AppToolContext } from '../tools/types';
|
|
2
|
+
import type { ConfusableTargetGroup } from './claim-support';
|
|
3
|
+
import type { WorkProductProvenanceBase } from './provenance';
|
|
4
|
+
import type { WorkProductArtifact, WorkProductRecord, WorkProductStorePort } from './types';
|
|
5
|
+
/** Max entries per `upsert_evidence`/`flag_exception` call — keeps each call a
|
|
6
|
+
* small batch the model can correct precisely on a named-index failure. */
|
|
7
|
+
export declare const MAX_WORK_PRODUCT_BATCH = 50;
|
|
8
|
+
/** Platform check: every material target has ≥1 evidence row. Recorded as
|
|
9
|
+
* `QualityCheck{source:'platform'}`. */
|
|
10
|
+
export declare const EVIDENCE_COVERAGE_CHECK = "evidence_coverage";
|
|
11
|
+
/** Platform check: how many evidence entries carry a quote the shell PROVED
|
|
12
|
+
* occurs in the source it names. Recorded when `readSourceText` is wired, so
|
|
13
|
+
* a reviewer reads the strength of the lineage off the row itself rather than
|
|
14
|
+
* trusting that a quote was checked. */
|
|
15
|
+
export declare const QUOTE_VERIFICATION_CHECK = "quote_verification";
|
|
16
|
+
/** Numeric-only platform check, omitted when no entries are checkable.
|
|
17
|
+
* Reports how many quoted evidence entries anchor to text that
|
|
18
|
+
* actually CARRIES the figure the entry claims. Distinct from
|
|
19
|
+
* `quote_verification`, which only proves the text came from the document —
|
|
20
|
+
* production row `7256ef49` passed that one on all four entries while
|
|
21
|
+
* supporting none of them. */
|
|
22
|
+
export declare const CLAIM_SUPPORT_CHECK = "claim_support";
|
|
23
|
+
/** Platform check: how many citations anchor to a line that belongs to the
|
|
24
|
+
* TARGET they are attached to, rather than to a sibling target's line.
|
|
25
|
+
* Recorded when the product declares `confusableTargets`; `claim_support`
|
|
26
|
+
* passes a crossed pair by construction, because the figure really is on the
|
|
27
|
+
* line — the wrong one. */
|
|
28
|
+
export declare const TARGET_CORRECTNESS_CHECK = "target_correctness";
|
|
29
|
+
/** Platform check: how many evidence claims agree with the artifact field they
|
|
30
|
+
* decorate. A package whose evidence reports one figure on a line and whose
|
|
31
|
+
* artifact reports another contradicts itself; every other gate on this row
|
|
32
|
+
* reads only one of the two halves. */
|
|
33
|
+
export declare const ARTIFACT_AGREEMENT_CHECK = "artifact_agreement";
|
|
34
|
+
/** Domain seams for the three work-product tools — every domain word is a
|
|
35
|
+
* parameter; the shell bakes none. */
|
|
36
|
+
export interface WorkProductToolConfig {
|
|
37
|
+
store: WorkProductStorePort;
|
|
38
|
+
/** PARAMETER — accepted `artifact.kind` values, validated on submit. */
|
|
39
|
+
artifactKinds: readonly string[];
|
|
40
|
+
/** PARAMETER — accepted exception `kind` values. */
|
|
41
|
+
exceptionKinds: readonly string[];
|
|
42
|
+
/** Fail-loud source check: resolve an evidence `sourceRef` to existence
|
|
43
|
+
* (vault stat / attachment lookup). A dangling ref is a `ToolInputError`
|
|
44
|
+
* naming the entry index — lineage can never point at nothing. */
|
|
45
|
+
resolveSourceRef: (ref: string, ctx: AppToolContext) => Promise<boolean>;
|
|
46
|
+
/** Fail-loud QUOTE verification: return the source document's TEXT for a
|
|
47
|
+
* ref so the shell can prove each `locator.quote` occurs in it verbatim.
|
|
48
|
+
* Wiring this turns the gate ON — a quote that does not occur is a
|
|
49
|
+
* `ToolInputError` naming the entry index, so the model re-extracts from
|
|
50
|
+
* the document instead of persisting invented lineage.
|
|
51
|
+
*
|
|
52
|
+
* Return `null` ONLY when the ref genuinely has no extractable text (an
|
|
53
|
+
* image scan, an opaque blob). The gate is fail-CLOSED on `null`: a quote
|
|
54
|
+
* that cannot be checked is refused, because "unverifiable" and "verified"
|
|
55
|
+
* must never look the same to a reviewer. Such an entry is still recordable
|
|
56
|
+
* without `locator.quote` — `claim` carries the assertion.
|
|
57
|
+
*
|
|
58
|
+
* Omit the seam entirely and no quote is checked. */
|
|
59
|
+
readSourceText?: (ref: string, ctx: AppToolContext) => Promise<string | null>;
|
|
60
|
+
/** The material targets the platform coverage check requires evidence for.
|
|
61
|
+
* Product-owned vocabulary; omit to skip the coverage gate.
|
|
62
|
+
*
|
|
63
|
+
* Return ONLY targets a source document can actually evidence. A gate that
|
|
64
|
+
* demands document lineage for a value the session COMPUTED is not
|
|
65
|
+
* satisfiable by any honest answer, and an unsatisfiable gate does not stop
|
|
66
|
+
* a submit — it selects for an invented one. Computed values belong to a
|
|
67
|
+
* product's own computation check, where "matches what we already
|
|
68
|
+
* calculated" is satisfiable by construction. */
|
|
69
|
+
materialTargets?: (artifact: WorkProductArtifact) => string[];
|
|
70
|
+
/** Require every material target to carry a SOURCE ANCHOR — a span-sliced or
|
|
71
|
+
* verified quote — not merely an evidence row. Off by default (a bare
|
|
72
|
+
* `claim` is legitimate lineage for products with no readable sources);
|
|
73
|
+
* turn it ON once `readSourceText` is wired and `materialTargets` names only
|
|
74
|
+
* document-derived targets, and coverage stops being satisfiable by
|
|
75
|
+
* assertion. */
|
|
76
|
+
requireAnchoredEvidence?: boolean;
|
|
77
|
+
/** Verify that each anchored quote CARRIES the figure its entry claims.
|
|
78
|
+
* ON by default — an anchor that does not support its claim is the one
|
|
79
|
+
* failure mode every other gate here passes, and it reads to a reviewer as
|
|
80
|
+
* the most authoritative citation on the row.
|
|
81
|
+
*
|
|
82
|
+
* Only claims that assert a figure are checked, so a filing status, a name
|
|
83
|
+
* or a date is unaffected; see `./claim-support` for exactly where the line
|
|
84
|
+
* is drawn and why it is drawn to stay satisfiable. Set `false` only for a
|
|
85
|
+
* product whose claims are figures the source states in a form no numeric
|
|
86
|
+
* comparison can reach. */
|
|
87
|
+
verifyClaimSupport?: boolean;
|
|
88
|
+
/** Fold an evidence `target` (and every `materialTargets` name) to the
|
|
89
|
+
* product's ONE canonical spelling.
|
|
90
|
+
*
|
|
91
|
+
* Without it a target namespace forks and every check that joins evidence
|
|
92
|
+
* to the artifact by name silently half-works. Measured on production row
|
|
93
|
+
* `95105c8a`: the same seven form lines arrived as `line_3a` and
|
|
94
|
+
* `f1040.line_3a` in one turn, so coverage, deduplication and artifact
|
|
95
|
+
* agreement each saw two unrelated targets where the return has one line.
|
|
96
|
+
*
|
|
97
|
+
* Pure and total — it runs on every ingested entry and on the coverage
|
|
98
|
+
* target list, so a target it does not recognize must come back unchanged
|
|
99
|
+
* rather than throw. */
|
|
100
|
+
normalizeTarget?: (target: string) => string;
|
|
101
|
+
/** Targets whose SOURCE LINES are mistakable for each other, with the
|
|
102
|
+
* phrases that tell them apart — the product's vocabulary, compared by the
|
|
103
|
+
* shell. Omit and no target-correctness check runs.
|
|
104
|
+
*
|
|
105
|
+
* Read negatively: an entry is refused only when the line it cites carries
|
|
106
|
+
* a sibling target's label and none of its own, so an unusually-labelled
|
|
107
|
+
* document never costs an honest citation. See `./claim-support` for why
|
|
108
|
+
* the positive form ("the line must say X") is the wrong shape. */
|
|
109
|
+
confusableTargets?: readonly ConfusableTargetGroup[];
|
|
110
|
+
/** Refuse an evidence claim that asserts a figure the artifact reports on a
|
|
111
|
+
* DIFFERENT target. ON by default and domain-free — it compares the package
|
|
112
|
+
* to itself. Set `false` only for a product whose evidence claims are not
|
|
113
|
+
* the artifact's own figures. */
|
|
114
|
+
verifyArtifactAgreement?: boolean;
|
|
115
|
+
/** Per-turn provenance closure the ROUTE supplies (profileHash + runId are
|
|
116
|
+
* known at dispatch; trusted, never read from model args). */
|
|
117
|
+
provenance: (ctx: AppToolContext) => WorkProductProvenanceBase;
|
|
118
|
+
/** Called on the draft→ready commit so the route persists the transcript
|
|
119
|
+
* anchor part and the queue projection updates. */
|
|
120
|
+
onReady?: (record: WorkProductRecord, ctx: AppToolContext) => void | Promise<void>;
|
|
121
|
+
/** Injectable clock / id generator (tests, deterministic ids). */
|
|
122
|
+
now?: () => number;
|
|
123
|
+
generateId?: () => string;
|
|
124
|
+
}
|
|
@@ -15,131 +15,9 @@
|
|
|
15
15
|
* from headers, never model args. A turn that dies mid-emission leaves a
|
|
16
16
|
* consistent draft the next turn resumes by the same scopeKey.
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
19
|
-
import type {
|
|
20
|
-
|
|
21
|
-
import { type ConfusableTargetGroup } from './claim-support';
|
|
22
|
-
import { type WorkProductArtifact, type WorkProductRecord, type WorkProductStorePort } from './types';
|
|
23
|
-
/** Max entries per `upsert_evidence`/`flag_exception` call — keeps each call a
|
|
24
|
-
* small batch the model can correct precisely on a named-index failure. */
|
|
25
|
-
export declare const MAX_WORK_PRODUCT_BATCH = 50;
|
|
26
|
-
/** Platform check: every material target has ≥1 evidence row. Recorded as
|
|
27
|
-
* `QualityCheck{source:'platform'}`. */
|
|
28
|
-
export declare const EVIDENCE_COVERAGE_CHECK = "evidence_coverage";
|
|
29
|
-
/** Platform check: how many evidence entries carry a quote the shell PROVED
|
|
30
|
-
* occurs in the source it names. Recorded when `readSourceText` is wired, so
|
|
31
|
-
* a reviewer reads the strength of the lineage off the row itself rather than
|
|
32
|
-
* trusting that a quote was checked. */
|
|
33
|
-
export declare const QUOTE_VERIFICATION_CHECK = "quote_verification";
|
|
34
|
-
/** Numeric-only platform check, omitted when no entries are checkable.
|
|
35
|
-
* Reports how many quoted evidence entries anchor to text that
|
|
36
|
-
* actually CARRIES the figure the entry claims. Distinct from
|
|
37
|
-
* `quote_verification`, which only proves the text came from the document —
|
|
38
|
-
* production row `7256ef49` passed that one on all four entries while
|
|
39
|
-
* supporting none of them. */
|
|
40
|
-
export declare const CLAIM_SUPPORT_CHECK = "claim_support";
|
|
41
|
-
/** Platform check: how many citations anchor to a line that belongs to the
|
|
42
|
-
* TARGET they are attached to, rather than to a sibling target's line.
|
|
43
|
-
* Recorded when the product declares `confusableTargets`; `claim_support`
|
|
44
|
-
* passes a crossed pair by construction, because the figure really is on the
|
|
45
|
-
* line — the wrong one. */
|
|
46
|
-
export declare const TARGET_CORRECTNESS_CHECK = "target_correctness";
|
|
47
|
-
/** Platform check: how many evidence claims agree with the artifact field they
|
|
48
|
-
* decorate. A package whose evidence reports one figure on a line and whose
|
|
49
|
-
* artifact reports another contradicts itself; every other gate on this row
|
|
50
|
-
* reads only one of the two halves. */
|
|
51
|
-
export declare const ARTIFACT_AGREEMENT_CHECK = "artifact_agreement";
|
|
52
|
-
/** Domain seams for the three work-product tools — every domain word is a
|
|
53
|
-
* parameter; the shell bakes none. */
|
|
54
|
-
export interface WorkProductToolConfig {
|
|
55
|
-
store: WorkProductStorePort;
|
|
56
|
-
/** PARAMETER — accepted `artifact.kind` values, validated on submit. */
|
|
57
|
-
artifactKinds: readonly string[];
|
|
58
|
-
/** PARAMETER — accepted exception `kind` values. */
|
|
59
|
-
exceptionKinds: readonly string[];
|
|
60
|
-
/** Fail-loud source check: resolve an evidence `sourceRef` to existence
|
|
61
|
-
* (vault stat / attachment lookup). A dangling ref is a `ToolInputError`
|
|
62
|
-
* naming the entry index — lineage can never point at nothing. */
|
|
63
|
-
resolveSourceRef: (ref: string, ctx: AppToolContext) => Promise<boolean>;
|
|
64
|
-
/** Fail-loud QUOTE verification: return the source document's TEXT for a
|
|
65
|
-
* ref so the shell can prove each `locator.quote` occurs in it verbatim.
|
|
66
|
-
* Wiring this turns the gate ON — a quote that does not occur is a
|
|
67
|
-
* `ToolInputError` naming the entry index, so the model re-extracts from
|
|
68
|
-
* the document instead of persisting invented lineage.
|
|
69
|
-
*
|
|
70
|
-
* Return `null` ONLY when the ref genuinely has no extractable text (an
|
|
71
|
-
* image scan, an opaque blob). The gate is fail-CLOSED on `null`: a quote
|
|
72
|
-
* that cannot be checked is refused, because "unverifiable" and "verified"
|
|
73
|
-
* must never look the same to a reviewer. Such an entry is still recordable
|
|
74
|
-
* without `locator.quote` — `claim` carries the assertion.
|
|
75
|
-
*
|
|
76
|
-
* Omit the seam entirely and no quote is checked. */
|
|
77
|
-
readSourceText?: (ref: string, ctx: AppToolContext) => Promise<string | null>;
|
|
78
|
-
/** The material targets the platform coverage check requires evidence for.
|
|
79
|
-
* Product-owned vocabulary; omit to skip the coverage gate.
|
|
80
|
-
*
|
|
81
|
-
* Return ONLY targets a source document can actually evidence. A gate that
|
|
82
|
-
* demands document lineage for a value the session COMPUTED is not
|
|
83
|
-
* satisfiable by any honest answer, and an unsatisfiable gate does not stop
|
|
84
|
-
* a submit — it selects for an invented one. Computed values belong to a
|
|
85
|
-
* product's own computation check, where "matches what we already
|
|
86
|
-
* calculated" is satisfiable by construction. */
|
|
87
|
-
materialTargets?: (artifact: WorkProductArtifact) => string[];
|
|
88
|
-
/** Require every material target to carry a SOURCE ANCHOR — a span-sliced or
|
|
89
|
-
* verified quote — not merely an evidence row. Off by default (a bare
|
|
90
|
-
* `claim` is legitimate lineage for products with no readable sources);
|
|
91
|
-
* turn it ON once `readSourceText` is wired and `materialTargets` names only
|
|
92
|
-
* document-derived targets, and coverage stops being satisfiable by
|
|
93
|
-
* assertion. */
|
|
94
|
-
requireAnchoredEvidence?: boolean;
|
|
95
|
-
/** Verify that each anchored quote CARRIES the figure its entry claims.
|
|
96
|
-
* ON by default — an anchor that does not support its claim is the one
|
|
97
|
-
* failure mode every other gate here passes, and it reads to a reviewer as
|
|
98
|
-
* the most authoritative citation on the row.
|
|
99
|
-
*
|
|
100
|
-
* Only claims that assert a figure are checked, so a filing status, a name
|
|
101
|
-
* or a date is unaffected; see `./claim-support` for exactly where the line
|
|
102
|
-
* is drawn and why it is drawn to stay satisfiable. Set `false` only for a
|
|
103
|
-
* product whose claims are figures the source states in a form no numeric
|
|
104
|
-
* comparison can reach. */
|
|
105
|
-
verifyClaimSupport?: boolean;
|
|
106
|
-
/** Fold an evidence `target` (and every `materialTargets` name) to the
|
|
107
|
-
* product's ONE canonical spelling.
|
|
108
|
-
*
|
|
109
|
-
* Without it a target namespace forks and every check that joins evidence
|
|
110
|
-
* to the artifact by name silently half-works. Measured on production row
|
|
111
|
-
* `95105c8a`: the same seven form lines arrived as `line_3a` and
|
|
112
|
-
* `f1040.line_3a` in one turn, so coverage, deduplication and artifact
|
|
113
|
-
* agreement each saw two unrelated targets where the return has one line.
|
|
114
|
-
*
|
|
115
|
-
* Pure and total — it runs on every ingested entry and on the coverage
|
|
116
|
-
* target list, so a target it does not recognize must come back unchanged
|
|
117
|
-
* rather than throw. */
|
|
118
|
-
normalizeTarget?: (target: string) => string;
|
|
119
|
-
/** Targets whose SOURCE LINES are mistakable for each other, with the
|
|
120
|
-
* phrases that tell them apart — the product's vocabulary, compared by the
|
|
121
|
-
* shell. Omit and no target-correctness check runs.
|
|
122
|
-
*
|
|
123
|
-
* Read negatively: an entry is refused only when the line it cites carries
|
|
124
|
-
* a sibling target's label and none of its own, so an unusually-labelled
|
|
125
|
-
* document never costs an honest citation. See `./claim-support` for why
|
|
126
|
-
* the positive form ("the line must say X") is the wrong shape. */
|
|
127
|
-
confusableTargets?: readonly ConfusableTargetGroup[];
|
|
128
|
-
/** Refuse an evidence claim that asserts a figure the artifact reports on a
|
|
129
|
-
* DIFFERENT target. ON by default and domain-free — it compares the package
|
|
130
|
-
* to itself. Set `false` only for a product whose evidence claims are not
|
|
131
|
-
* the artifact's own figures. */
|
|
132
|
-
verifyArtifactAgreement?: boolean;
|
|
133
|
-
/** Per-turn provenance closure the ROUTE supplies (profileHash + runId are
|
|
134
|
-
* known at dispatch; trusted, never read from model args). */
|
|
135
|
-
provenance: (ctx: AppToolContext) => WorkProductProvenanceBase;
|
|
136
|
-
/** Called on the draft→ready commit so the route persists the transcript
|
|
137
|
-
* anchor part and the queue projection updates. */
|
|
138
|
-
onReady?: (record: WorkProductRecord, ctx: AppToolContext) => void | Promise<void>;
|
|
139
|
-
/** Injectable clock / id generator (tests, deterministic ids). */
|
|
140
|
-
now?: () => number;
|
|
141
|
-
generateId?: () => string;
|
|
142
|
-
}
|
|
18
|
+
import type { AppToolDefinition } from '../tools/registry';
|
|
19
|
+
import type { WorkProductToolConfig } from './tool-config';
|
|
20
|
+
export * from './tool-config';
|
|
143
21
|
/** Build the three work-product tools for `customTools` registration on the
|
|
144
22
|
* MCP server / HTTP handler / runtime executor. */
|
|
145
23
|
export declare function buildWorkProductTools(config: WorkProductToolConfig): AppToolDefinition[];
|
package/package.json
CHANGED