@tangle-network/agent-app 0.57.19 → 0.58.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/VaultPane-UHLJSIND.js +7 -0
- package/dist/assistant/index.js +5 -4
- package/dist/assistant/index.js.map +1 -1
- package/dist/channels/index.js +1 -1
- package/dist/chunk-3NVVBQ2U.js +131 -0
- package/dist/chunk-3NVVBQ2U.js.map +1 -0
- package/dist/{chunk-EPZYYWCT.js → chunk-6ZIC6OG5.js} +8 -2
- package/dist/{chunk-EPZYYWCT.js.map → chunk-6ZIC6OG5.js.map} +1 -1
- package/dist/{chunk-OGFDE4IR.js → chunk-E2HFIKIZ.js} +2 -2
- package/dist/{chunk-Q3ZHNN5X.js → chunk-LSUELMHY.js} +2 -2
- package/dist/chunk-LSUELMHY.js.map +1 -0
- package/dist/chunk-M6WST7ZH.js +265 -0
- package/dist/chunk-M6WST7ZH.js.map +1 -0
- package/dist/{chunk-IOUPOUYB.js → chunk-XADC73A7.js} +2 -2
- package/dist/chunk-XADC73A7.js.map +1 -0
- package/dist/copy-quality/index.d.ts +88 -0
- package/dist/copy-quality/index.js +22 -0
- package/dist/copy-quality/index.js.map +1 -0
- package/dist/integrations-react/index.js +1 -1
- package/dist/legibility/cli.js +1 -1
- package/dist/legibility/index.js +1 -1
- package/dist/profile/agent-prompt.d.ts +91 -0
- package/dist/profile/index.d.ts +15 -49
- package/dist/profile/index.js +316 -10
- package/dist/profile/index.js.map +1 -1
- package/dist/profile/model-input.d.ts +94 -0
- package/dist/profile/operating-contract.d.ts +44 -0
- package/dist/profile/quality-skills.d.ts +33 -0
- package/dist/vault/index.js +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/async/index.js +1 -1
- package/dist/web-react/async/state.d.ts +1 -1
- package/dist/web-react/index.js +2 -2
- package/dist/work-product/index.js +12 -118
- package/dist/work-product/index.js.map +1 -1
- package/package.json +6 -1
- package/dist/VaultPane-SDNMDGFC.js +0 -7
- package/dist/chunk-IOUPOUYB.js.map +0 -1
- package/dist/chunk-Q3ZHNN5X.js.map +0 -1
- /package/dist/{VaultPane-SDNMDGFC.js.map → VaultPane-UHLJSIND.js.map} +0 -0
- /package/dist/{chunk-OGFDE4IR.js.map → chunk-E2HFIKIZ.js.map} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared operating contract: the rules every product agent follows whatever
|
|
3
|
+
* its domain. Products used to hand-write these as "How you operate" bullets,
|
|
4
|
+
* and the copies drifted apart (different labels for unsupported claims, a
|
|
5
|
+
* read-back rule in one product and not the others). Rendering one contract
|
|
6
|
+
* keeps them identical, and its version lets a receipt name the exact wording a
|
|
7
|
+
* turn saw.
|
|
8
|
+
*
|
|
9
|
+
* Changing any clause text requires bumping {@link OPERATING_CONTRACT_VERSION};
|
|
10
|
+
* the test suite pins the digest of each version's default rendering, so an
|
|
11
|
+
* unversioned wording change fails there.
|
|
12
|
+
*/
|
|
13
|
+
/** Version of the clause wording below. Bump it whenever any clause text changes. */
|
|
14
|
+
export declare const OPERATING_CONTRACT_VERSION = 1;
|
|
15
|
+
export type OperatingContractClauseId = 'deliver' | 'evidence' | 'inspect-results' | 'authority' | 'this-turn' | 'read-back' | 'vault-memory';
|
|
16
|
+
export interface OperatingContractClause {
|
|
17
|
+
id: OperatingContractClauseId;
|
|
18
|
+
text: string;
|
|
19
|
+
}
|
|
20
|
+
/** The clauses in render order. */
|
|
21
|
+
export declare const OPERATING_CONTRACT_CLAUSES: readonly OperatingContractClause[];
|
|
22
|
+
/** Product adjustments to the shared contract. */
|
|
23
|
+
export interface OperatingContractOptions {
|
|
24
|
+
/** Clauses that cannot apply on this lane, such as `vault-memory` and
|
|
25
|
+
* `read-back` on a lane with no workspace files. The rendered result lists
|
|
26
|
+
* the clauses kept, so a receipt shows what was left out. */
|
|
27
|
+
omit?: readonly OperatingContractClauseId[];
|
|
28
|
+
/** How the agent marks a claim it cannot support. Default
|
|
29
|
+
* `Unverified: <claim>`; a product with a mandated format passes it here
|
|
30
|
+
* instead of restating the evidence rule in its own words. */
|
|
31
|
+
unverifiedLabel?: string;
|
|
32
|
+
/** Product clauses appended after the shared ones, one bullet each. */
|
|
33
|
+
additions?: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
export interface RenderedOperatingContract {
|
|
36
|
+
version: number;
|
|
37
|
+
/** `## Operating contract` followed by one bullet per clause. */
|
|
38
|
+
text: string;
|
|
39
|
+
/** Shared clauses kept, in render order. */
|
|
40
|
+
clauseIds: OperatingContractClauseId[];
|
|
41
|
+
}
|
|
42
|
+
/** Render the contract as a prompt section. Throws on an unknown `omit` id so a
|
|
43
|
+
* typo cannot silently keep a clause the product meant to drop. */
|
|
44
|
+
export declare function renderOperatingContract(options?: OperatingContractOptions): RenderedOperatingContract;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default quality skills every product agent mounts.
|
|
3
|
+
*
|
|
4
|
+
* `human-prose` was copied into three products byte-for-byte (GTM's catalog,
|
|
5
|
+
* tax, creative), each with its own frontmatter. This module is now its one
|
|
6
|
+
* source; a product adds its own vocabulary through options instead of editing
|
|
7
|
+
* a copy. The vocabulary comes from the copy-quality scanner's ban and cap
|
|
8
|
+
* tiers, so the words the skill tells the agent to avoid are the words the
|
|
9
|
+
* scanner flags.
|
|
10
|
+
*/
|
|
11
|
+
import { type SkillEntry } from '../skills/index';
|
|
12
|
+
export declare const HUMAN_PROSE_SKILL_ID = "human-prose";
|
|
13
|
+
/** Product additions to the shared writing skill. */
|
|
14
|
+
export interface HumanProseSkillOptions {
|
|
15
|
+
/** Product words to ban in addition to the copy-quality ban tier. */
|
|
16
|
+
bannedWords?: readonly string[];
|
|
17
|
+
/** Product terms, keyed by the wording to avoid. */
|
|
18
|
+
preferredTerms?: Readonly<Record<string, string>>;
|
|
19
|
+
/** Id of a mounted skill for a full review-and-rewrite pass, named as the
|
|
20
|
+
* next step for long drafts. Leave unset unless that skill is mounted. */
|
|
21
|
+
reviewSkillId?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface QualitySkillOptions {
|
|
24
|
+
writing?: HumanProseSkillOptions;
|
|
25
|
+
}
|
|
26
|
+
/** The shared writing skill as a mountable {@link SkillEntry}. */
|
|
27
|
+
export declare function humanProseSkill(options?: HumanProseSkillOptions): SkillEntry;
|
|
28
|
+
/** The quality skills mounted by default. */
|
|
29
|
+
export declare function defaultQualitySkills(options?: QualitySkillOptions): SkillEntry[];
|
|
30
|
+
/** Append the default quality skills to a product's skills. Throws when the
|
|
31
|
+
* product still carries its own copy of a default skill: delete the copy and
|
|
32
|
+
* move its additions into the options. */
|
|
33
|
+
export declare function withDefaultQualitySkills(productSkills: readonly SkillEntry[], options?: QualitySkillOptions): SkillEntry[];
|
package/dist/vault/index.js
CHANGED
package/dist/vault/lazy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/vault/lazy.tsx
|
|
2
2
|
import { lazy } from "react";
|
|
3
3
|
var VaultPaneLazy = lazy(
|
|
4
|
-
() => import("../VaultPane-
|
|
4
|
+
() => import("../VaultPane-UHLJSIND.js").then((m) => ({ default: m.VaultPane }))
|
|
5
5
|
);
|
|
6
6
|
export {
|
|
7
7
|
VaultPaneLazy
|
|
@@ -62,7 +62,7 @@ export type AsyncResolution<T> = {
|
|
|
62
62
|
readonly status: 'ready';
|
|
63
63
|
readonly value: T;
|
|
64
64
|
};
|
|
65
|
-
export declare const DEFAULT_ASYNC_ERROR_MESSAGE = "
|
|
65
|
+
export declare const DEFAULT_ASYNC_ERROR_MESSAGE = "This did not load. Try again.";
|
|
66
66
|
/**
|
|
67
67
|
* Default emptiness rule: `null`/`undefined`, an empty array, an empty `Map` or
|
|
68
68
|
* `Set`. A string, a number and a plain object are `ready` — `''` and `{}` are
|
package/dist/web-react/index.js
CHANGED
|
@@ -134,7 +134,7 @@ import {
|
|
|
134
134
|
withoutRecordGridCreated,
|
|
135
135
|
withoutRecordGridRemoved,
|
|
136
136
|
withoutRecordGridUpdate
|
|
137
|
-
} from "../chunk-
|
|
137
|
+
} from "../chunk-E2HFIKIZ.js";
|
|
138
138
|
import {
|
|
139
139
|
SessionHistoryPanel,
|
|
140
140
|
formatSessionTimestamp,
|
|
@@ -211,7 +211,7 @@ import {
|
|
|
211
211
|
import {
|
|
212
212
|
ProviderLogo
|
|
213
213
|
} from "../chunk-MLG6XKPV.js";
|
|
214
|
-
import "../chunk-
|
|
214
|
+
import "../chunk-LSUELMHY.js";
|
|
215
215
|
import "../chunk-FQYAJYPW.js";
|
|
216
216
|
import {
|
|
217
217
|
ATTACHMENT_ACCEPT
|
|
@@ -2,6 +2,18 @@ import {
|
|
|
2
2
|
parseReviewQueueItem,
|
|
3
3
|
projectReviewQueue
|
|
4
4
|
} from "../chunk-GEYACSFW.js";
|
|
5
|
+
import {
|
|
6
|
+
artifactAgreementErrorDetail,
|
|
7
|
+
canonicalizeValue,
|
|
8
|
+
claimSupportErrorDetail,
|
|
9
|
+
claimValues,
|
|
10
|
+
indexArtifactValues,
|
|
11
|
+
targetLabelErrorDetail,
|
|
12
|
+
valuesInText,
|
|
13
|
+
verifyArtifactAgreement,
|
|
14
|
+
verifyClaimSupport,
|
|
15
|
+
verifyTargetLabel
|
|
16
|
+
} from "../chunk-3NVVBQ2U.js";
|
|
5
17
|
import {
|
|
6
18
|
defineAppTool
|
|
7
19
|
} from "../chunk-4CBU7QIL.js";
|
|
@@ -20,124 +32,6 @@ import {
|
|
|
20
32
|
workProductToPersistedPart
|
|
21
33
|
} from "../chunk-ZVEEWGDK.js";
|
|
22
34
|
|
|
23
|
-
// src/work-product/claim-support.ts
|
|
24
|
-
var CURRENCY = /[$€£¥₹]/gu;
|
|
25
|
-
var NUMBER_IN_TEXT = /[$€£¥₹]?\s*\d{1,3}(?:,\d{3})+(?:\.\d+)?|[$€£¥₹]?\s*\d+(?:\.\d+)?/gu;
|
|
26
|
-
var FIGURE_IN_PROSE = /[$€£¥₹]\s*[-+]?\d[\d,]*(?:\.\d+)?|[-+]?\d{1,3}(?:,\d{3})+(?:\.\d+)?|[-+]?\d+\.\d{2}(?!\d)/gu;
|
|
27
|
-
var WHOLE_VALUE = /^[$€£¥₹]?\s*[-+]?\s*(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?\s*%?$/u;
|
|
28
|
-
function canonicalizeValue(token) {
|
|
29
|
-
let text = token.trim();
|
|
30
|
-
if (text.length === 0) return null;
|
|
31
|
-
if (/^\(.*\)$/u.test(text)) text = text.slice(1, -1).trim();
|
|
32
|
-
text = text.replace(CURRENCY, "").trim();
|
|
33
|
-
text = text.replace(/^[-+]\s*/u, "").trim();
|
|
34
|
-
text = text.replace(/%$/u, "").trim();
|
|
35
|
-
if (!/^(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?$/u.test(text)) return null;
|
|
36
|
-
text = text.replace(/,/gu, "");
|
|
37
|
-
if (text.includes(".")) text = text.replace(/0+$/u, "").replace(/\.$/u, "");
|
|
38
|
-
text = text.replace(/^0+(?=\d)/u, "");
|
|
39
|
-
return text.length === 0 ? null : text;
|
|
40
|
-
}
|
|
41
|
-
function valuesInText(text) {
|
|
42
|
-
const seen = /* @__PURE__ */ new Set();
|
|
43
|
-
for (const match of text.matchAll(NUMBER_IN_TEXT)) {
|
|
44
|
-
const canonical = canonicalizeValue(match[0]);
|
|
45
|
-
if (canonical !== null) seen.add(canonical);
|
|
46
|
-
}
|
|
47
|
-
return [...seen];
|
|
48
|
-
}
|
|
49
|
-
function claimValues(claim) {
|
|
50
|
-
const trimmed = claim.trim();
|
|
51
|
-
if (WHOLE_VALUE.test(trimmed)) {
|
|
52
|
-
const whole = canonicalizeValue(trimmed);
|
|
53
|
-
if (whole !== null) return [whole];
|
|
54
|
-
}
|
|
55
|
-
const seen = /* @__PURE__ */ new Set();
|
|
56
|
-
for (const match of trimmed.matchAll(FIGURE_IN_PROSE)) {
|
|
57
|
-
const canonical = canonicalizeValue(match[0]);
|
|
58
|
-
if (canonical !== null) seen.add(canonical);
|
|
59
|
-
}
|
|
60
|
-
return [...seen];
|
|
61
|
-
}
|
|
62
|
-
function verifyClaimSupport(quote, claim) {
|
|
63
|
-
if (quote.trim().length === 0) return { status: "not_applicable" };
|
|
64
|
-
const claimed = claimValues(claim);
|
|
65
|
-
if (claimed.length === 0) return { status: "not_applicable" };
|
|
66
|
-
const present = valuesInText(quote);
|
|
67
|
-
const matched = claimed.find((value) => present.includes(value));
|
|
68
|
-
if (matched !== void 0) return { status: "supported", matched };
|
|
69
|
-
return { status: "unsupported", claimed, present };
|
|
70
|
-
}
|
|
71
|
-
function excerpt(quote, limit = 120) {
|
|
72
|
-
const flat = quote.replace(/\s+/gu, " ").trim();
|
|
73
|
-
return flat.length <= limit ? flat : `${flat.slice(0, limit)}\u2026`;
|
|
74
|
-
}
|
|
75
|
-
function claimSupportErrorDetail(failure, quote) {
|
|
76
|
-
const wanted = failure.claimed.length === 1 ? failure.claimed[0] : `any of ${failure.claimed.join(", ")}`;
|
|
77
|
-
const carries = failure.present.length === 0 ? "that line carries no figure at all" : `the only figures on it are ${failure.present.join(", ")}`;
|
|
78
|
-
return `the cited text does not contain ${wanted}. It reads "${excerpt(quote)}", and ${carries}. Cite locator.find with the value exactly as it appears in the document and the platform will locate the right line for you. If this figure was COMPUTED rather than read from the document, omit the locator entirely and state the computation in claim.`;
|
|
79
|
-
}
|
|
80
|
-
function foldLabel(value) {
|
|
81
|
-
return value.normalize("NFKC").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
82
|
-
}
|
|
83
|
-
function verifyTargetLabel(quote, target, groups) {
|
|
84
|
-
if (quote.trim().length === 0) return { status: "not_applicable" };
|
|
85
|
-
const group = groups.find((candidate) => Object.hasOwn(candidate.labels, target));
|
|
86
|
-
if (!group) return { status: "not_applicable" };
|
|
87
|
-
const line = ` ${foldLabel(quote)} `;
|
|
88
|
-
const own = group.labels[target] ?? [];
|
|
89
|
-
for (const label of own) {
|
|
90
|
-
const folded = foldLabel(label);
|
|
91
|
-
if (folded.length > 0 && line.includes(folded)) return { status: "identified", label };
|
|
92
|
-
}
|
|
93
|
-
for (const [rival, labels] of Object.entries(group.labels)) {
|
|
94
|
-
if (rival === target) continue;
|
|
95
|
-
for (const label of labels) {
|
|
96
|
-
const folded = foldLabel(label);
|
|
97
|
-
if (folded.length === 0 || !line.includes(folded)) continue;
|
|
98
|
-
return {
|
|
99
|
-
status: "crossed",
|
|
100
|
-
rival,
|
|
101
|
-
rivalLabel: label,
|
|
102
|
-
expected: own,
|
|
103
|
-
...group.note === void 0 ? {} : { note: group.note }
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return { status: "not_applicable" };
|
|
108
|
-
}
|
|
109
|
-
function targetLabelErrorDetail(failure, target, quote) {
|
|
110
|
-
const ownLooks = failure.expected.length === 0 ? "" : ` A citation for ${target} should land on the line naming ${failure.expected.map((label) => JSON.stringify(label)).join(" or ")}.`;
|
|
111
|
-
const note = failure.note === void 0 ? "" : ` (${failure.note})`;
|
|
112
|
-
return `the line it cites reads "${excerpt(quote)}", which is the line for ${failure.rival} \u2014 it names ${JSON.stringify(failure.rivalLabel)}${note}.${ownLooks} Cite the line that belongs to this target, or attach this citation to ${failure.rival} instead. The figure is real; it is on the wrong line.`;
|
|
113
|
-
}
|
|
114
|
-
function indexArtifactValues(fields, normalizeTarget) {
|
|
115
|
-
const index = /* @__PURE__ */ new Map();
|
|
116
|
-
for (const [key, raw] of Object.entries(fields ?? {})) {
|
|
117
|
-
const value = typeof raw === "number" && Number.isFinite(raw) ? canonicalizeValue(String(raw)) : typeof raw === "string" ? canonicalizeValue(raw) : null;
|
|
118
|
-
if (value === null) continue;
|
|
119
|
-
index.set(normalizeTarget ? normalizeTarget(key) : key, value);
|
|
120
|
-
}
|
|
121
|
-
return index;
|
|
122
|
-
}
|
|
123
|
-
function verifyArtifactAgreement(target, claim, fieldValues) {
|
|
124
|
-
const expected = fieldValues.get(target);
|
|
125
|
-
if (expected === void 0) return { status: "not_applicable" };
|
|
126
|
-
const claimed = claimValues(claim);
|
|
127
|
-
if (claimed.length === 0) return { status: "not_applicable" };
|
|
128
|
-
if (claimed.includes(expected)) return { status: "agrees", value: expected };
|
|
129
|
-
for (const value of claimed) {
|
|
130
|
-
for (const [other, otherValue] of fieldValues) {
|
|
131
|
-
if (other === target || otherValue !== value) continue;
|
|
132
|
-
return { status: "contradicts", claimed: value, expected, belongsTo: other };
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return { status: "not_applicable" };
|
|
136
|
-
}
|
|
137
|
-
function artifactAgreementErrorDetail(failure, target) {
|
|
138
|
-
return `the artifact reports ${failure.expected} on ${target} and ${failure.claimed} on ${failure.belongsTo}, so a citation claiming ${failure.claimed} does not support ${target} \u2014 it supports ${failure.belongsTo}. Attach this citation to ${failure.belongsTo}, or correct the artifact if ${target} really is ${failure.claimed}. The package cannot state both.`;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
35
|
// src/work-product/service.ts
|
|
142
36
|
var WORK_PRODUCT_TRANSITIONS = {
|
|
143
37
|
draft: /* @__PURE__ */ new Set(["blocked", "ready"]),
|