@lore-co/core 0.2.20 → 0.2.21
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/approaches.d.ts +431 -36
- package/dist/approaches.d.ts.map +1 -1
- package/dist/approaches.js +68 -7
- package/dist/approaches.js.map +1 -1
- package/dist/cloud-recovery-schemas.d.ts +2 -2
- package/dist/connector-review.d.ts +11 -0
- package/dist/connector-review.d.ts.map +1 -0
- package/dist/connector-review.js +36 -0
- package/dist/connector-review.js.map +1 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +17 -10
- package/dist/engine.js.map +1 -1
- package/dist/guard-schemas.d.ts +4 -4
- package/dist/host-envelopes.d.ts +110 -0
- package/dist/host-envelopes.d.ts.map +1 -0
- package/dist/host-envelopes.js +282 -0
- package/dist/host-envelopes.js.map +1 -0
- package/dist/in-memory-repository.d.ts +8 -1
- package/dist/in-memory-repository.d.ts.map +1 -1
- package/dist/in-memory-repository.js +49 -3
- package/dist/in-memory-repository.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/integration-contract.d.ts +32 -32
- package/dist/knowledge-quality.d.ts +19 -0
- package/dist/knowledge-quality.d.ts.map +1 -1
- package/dist/knowledge-quality.js +76 -1
- package/dist/knowledge-quality.js.map +1 -1
- package/dist/learning-drafts.d.ts +1 -1
- package/dist/pilot-schemas.d.ts +68 -47
- package/dist/pilot-schemas.d.ts.map +1 -1
- package/dist/pilot-schemas.js +16 -0
- package/dist/pilot-schemas.js.map +1 -1
- package/dist/ports.d.ts +7 -1
- package/dist/ports.d.ts.map +1 -1
- package/dist/ports.js.map +1 -1
- package/dist/prepared-context.d.ts +2 -0
- package/dist/prepared-context.d.ts.map +1 -1
- package/dist/prepared-context.js +10 -7
- package/dist/prepared-context.js.map +1 -1
- package/dist/product-usage.d.ts +6 -6
- package/dist/reliability-schemas.d.ts +28 -7
- package/dist/reliability-schemas.d.ts.map +1 -1
- package/dist/reliability-schemas.js +28 -3
- package/dist/reliability-schemas.js.map +1 -1
- package/dist/repository-location.d.ts +7 -0
- package/dist/repository-location.d.ts.map +1 -1
- package/dist/repository-location.js +12 -3
- package/dist/repository-location.js.map +1 -1
- package/dist/schemas.d.ts +71 -53
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +24 -0
- package/dist/schemas.js.map +1 -1
- package/dist/search-schemas.d.ts +5 -5
- package/dist/session-purpose.d.ts.map +1 -1
- package/dist/session-purpose.js +6 -2
- package/dist/session-purpose.js.map +1 -1
- package/dist/session-schemas.d.ts +24 -10
- package/dist/session-schemas.d.ts.map +1 -1
- package/dist/session-schemas.js +11 -0
- package/dist/session-schemas.js.map +1 -1
- package/dist/session-titles.d.ts +34 -0
- package/dist/session-titles.d.ts.map +1 -0
- package/dist/session-titles.js +31 -0
- package/dist/session-titles.js.map +1 -0
- package/dist/skill-context.d.ts +5 -0
- package/dist/skill-context.d.ts.map +1 -1
- package/dist/skill-context.js +16 -0
- package/dist/skill-context.js.map +1 -1
- package/dist/skills.d.ts +8 -8
- package/dist/snapshot-schemas.d.ts +32 -32
- package/dist/turn-context-request.d.ts +10 -0
- package/dist/turn-context-request.d.ts.map +1 -0
- package/dist/turn-context-request.js +28 -0
- package/dist/turn-context-request.js.map +1 -0
- package/dist/user-message.d.ts +9 -1
- package/dist/user-message.d.ts.map +1 -1
- package/dist/user-message.js +26 -36
- package/dist/user-message.js.map +1 -1
- package/package.json +9 -1
package/dist/skill-context.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
export const MAX_SKILL_CONTEXT_CHARACTERS = 72_000;
|
|
2
2
|
export const SKILL_CONTEXT_UNAVAILABLE = "Lore could not check enabled skills for this task. Do not assume a skill review has happened. Retry Lore before relying on its skill instructions.";
|
|
3
|
+
/** Name and purpose only, for a pack a person pastes by hand; connected agents receive the full instructions from Lore. */
|
|
4
|
+
export function packSkillSummary(skills, hasMore = false) {
|
|
5
|
+
const enabled = skills.filter(skill => skill.enabled && skill.status === "active").sort((a, b) => a.name.localeCompare(b.name));
|
|
6
|
+
if (!enabled.length && !hasMore)
|
|
7
|
+
return { text: "Lore skills checked: none are enabled for this repository. Do not reapply Lore skills from previous tasks.", count: 0 };
|
|
8
|
+
const lines = enabled.map(skill => `- ${skill.title} (${skill.name}): ${skill.description.split(/\r?\n/u)[0]?.trim() ?? ""}`.trimEnd());
|
|
9
|
+
return {
|
|
10
|
+
text: [
|
|
11
|
+
"## Enabled Lore skills",
|
|
12
|
+
"Apply these skills when their descriptions match the task. Agents connected to Lore load each skill's full instructions themselves; they are not repeated here.",
|
|
13
|
+
lines.join("\n"),
|
|
14
|
+
hasMore ? "Some enabled skills are not listed. Use `lore skill list` to see them all." : "",
|
|
15
|
+
].filter(Boolean).join("\n\n"),
|
|
16
|
+
count: enabled.length,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
3
19
|
/** Deliver complete instructions, never a cut-off workflow. Relevance orders the
|
|
4
20
|
* bounded pack; the skill's description still determines when it applies. */
|
|
5
21
|
export function packSkillContext(skills, task, maxCharacters = MAX_SKILL_CONTEXT_CHARACTERS, hasMore = false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-context.js","sourceRoot":"","sources":["../src/skill-context.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC;AACnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,oJAAoJ,CAAC;AAE9L;6EAC6E;AAC7E,MAAM,UAAU,gBAAgB,CAC9B,MAAwB,EACxB,IAAY,EACZ,aAAa,GAAG,4BAA4B,EAC5C,OAAO,GAAG,KAAK;IAEf,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;IACnF,IAA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CAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,kBAAkB,KAAK,CAAC,IAAI,IAAI,oCAAoC,cAAc,KAAK,CAAC,OAAO,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrK,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,aAAa,EAAE,CAAC;YAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QACnF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/skills.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ export type SkillSource = z.infer<typeof SkillSourceSchema>;
|
|
|
32
32
|
/** Preserve the original document. Metadata describes a skill; it never grants permissions. */
|
|
33
33
|
export declare function parseSkillMarkdown(markdown: string): SkillDocument;
|
|
34
34
|
export declare const SkillSummarySchema: z.ZodObject<{
|
|
35
|
-
name: z.ZodString;
|
|
36
35
|
description: z.ZodString;
|
|
36
|
+
name: z.ZodString;
|
|
37
37
|
title: z.ZodString;
|
|
38
38
|
repo: z.ZodNullable<z.ZodString>;
|
|
39
39
|
source: z.ZodObject<{
|
|
@@ -46,8 +46,8 @@ export declare const SkillSummarySchema: z.ZodObject<{
|
|
|
46
46
|
reference: z.ZodString;
|
|
47
47
|
}, z.core.$strict>;
|
|
48
48
|
status: z.ZodEnum<{
|
|
49
|
-
proposed: "proposed";
|
|
50
49
|
active: "active";
|
|
50
|
+
proposed: "proposed";
|
|
51
51
|
}>;
|
|
52
52
|
enabled: z.ZodBoolean;
|
|
53
53
|
version: z.ZodNumber;
|
|
@@ -56,8 +56,8 @@ export declare const SkillSummarySchema: z.ZodObject<{
|
|
|
56
56
|
updatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
57
57
|
}, z.core.$strict>;
|
|
58
58
|
export declare const SkillSchema: z.ZodObject<{
|
|
59
|
-
name: z.ZodString;
|
|
60
59
|
description: z.ZodString;
|
|
60
|
+
name: z.ZodString;
|
|
61
61
|
title: z.ZodString;
|
|
62
62
|
repo: z.ZodNullable<z.ZodString>;
|
|
63
63
|
source: z.ZodObject<{
|
|
@@ -70,8 +70,8 @@ export declare const SkillSchema: z.ZodObject<{
|
|
|
70
70
|
reference: z.ZodString;
|
|
71
71
|
}, z.core.$strict>;
|
|
72
72
|
status: z.ZodEnum<{
|
|
73
|
-
proposed: "proposed";
|
|
74
73
|
active: "active";
|
|
74
|
+
proposed: "proposed";
|
|
75
75
|
}>;
|
|
76
76
|
enabled: z.ZodBoolean;
|
|
77
77
|
version: z.ZodNumber;
|
|
@@ -84,8 +84,8 @@ export type Skill = z.infer<typeof SkillSchema>;
|
|
|
84
84
|
export type SkillSummary = z.infer<typeof SkillSummarySchema>;
|
|
85
85
|
export declare const SkillResponseSchema: z.ZodObject<{
|
|
86
86
|
skill: z.ZodObject<{
|
|
87
|
-
name: z.ZodString;
|
|
88
87
|
description: z.ZodString;
|
|
88
|
+
name: z.ZodString;
|
|
89
89
|
title: z.ZodString;
|
|
90
90
|
repo: z.ZodNullable<z.ZodString>;
|
|
91
91
|
source: z.ZodObject<{
|
|
@@ -98,8 +98,8 @@ export declare const SkillResponseSchema: z.ZodObject<{
|
|
|
98
98
|
reference: z.ZodString;
|
|
99
99
|
}, z.core.$strict>;
|
|
100
100
|
status: z.ZodEnum<{
|
|
101
|
-
proposed: "proposed";
|
|
102
101
|
active: "active";
|
|
102
|
+
proposed: "proposed";
|
|
103
103
|
}>;
|
|
104
104
|
enabled: z.ZodBoolean;
|
|
105
105
|
version: z.ZodNumber;
|
|
@@ -120,8 +120,8 @@ export declare const ListSkillsSchema: z.ZodObject<{
|
|
|
120
120
|
}, z.core.$strict>;
|
|
121
121
|
export declare const ListSkillsResponseSchema: z.ZodObject<{
|
|
122
122
|
skills: z.ZodArray<z.ZodObject<{
|
|
123
|
-
name: z.ZodString;
|
|
124
123
|
description: z.ZodString;
|
|
124
|
+
name: z.ZodString;
|
|
125
125
|
title: z.ZodString;
|
|
126
126
|
repo: z.ZodNullable<z.ZodString>;
|
|
127
127
|
source: z.ZodObject<{
|
|
@@ -134,8 +134,8 @@ export declare const ListSkillsResponseSchema: z.ZodObject<{
|
|
|
134
134
|
reference: z.ZodString;
|
|
135
135
|
}, z.core.$strict>;
|
|
136
136
|
status: z.ZodEnum<{
|
|
137
|
-
proposed: "proposed";
|
|
138
137
|
active: "active";
|
|
138
|
+
proposed: "proposed";
|
|
139
139
|
}>;
|
|
140
140
|
enabled: z.ZodBoolean;
|
|
141
141
|
version: z.ZodNumber;
|
|
@@ -116,8 +116,8 @@ export declare const SignedContextPayloadSchema: z.ZodObject<{
|
|
|
116
116
|
other: "other";
|
|
117
117
|
}>;
|
|
118
118
|
status: z.ZodEnum<{
|
|
119
|
-
proposed: "proposed";
|
|
120
119
|
active: "active";
|
|
120
|
+
proposed: "proposed";
|
|
121
121
|
suppressed: "suppressed";
|
|
122
122
|
superseded: "superseded";
|
|
123
123
|
deleted: "deleted";
|
|
@@ -191,8 +191,8 @@ export declare const SignedContextPayloadSchema: z.ZodObject<{
|
|
|
191
191
|
other: "other";
|
|
192
192
|
}>;
|
|
193
193
|
status: z.ZodEnum<{
|
|
194
|
-
proposed: "proposed";
|
|
195
194
|
active: "active";
|
|
195
|
+
proposed: "proposed";
|
|
196
196
|
suppressed: "suppressed";
|
|
197
197
|
superseded: "superseded";
|
|
198
198
|
deleted: "deleted";
|
|
@@ -269,14 +269,14 @@ export declare const SignedContextPayloadSchema: z.ZodObject<{
|
|
|
269
269
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
270
270
|
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
271
271
|
agent: z.ZodString;
|
|
272
|
-
eventId: z.ZodOptional<z.ZodUUID>;
|
|
273
272
|
messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
273
|
+
eventId: z.ZodOptional<z.ZodUUID>;
|
|
274
274
|
userId: z.ZodOptional<z.ZodUUID>;
|
|
275
275
|
redacted: z.ZodOptional<z.ZodBoolean>;
|
|
276
276
|
}, z.core.$strict>;
|
|
277
277
|
status: z.ZodEnum<{
|
|
278
|
-
proposed: "proposed";
|
|
279
278
|
active: "active";
|
|
279
|
+
proposed: "proposed";
|
|
280
280
|
suppressed: "suppressed";
|
|
281
281
|
superseded: "superseded";
|
|
282
282
|
deleted: "deleted";
|
|
@@ -538,8 +538,8 @@ export declare const SignedSnapshotPayloadSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
538
538
|
other: "other";
|
|
539
539
|
}>;
|
|
540
540
|
status: z.ZodEnum<{
|
|
541
|
-
proposed: "proposed";
|
|
542
541
|
active: "active";
|
|
542
|
+
proposed: "proposed";
|
|
543
543
|
suppressed: "suppressed";
|
|
544
544
|
superseded: "superseded";
|
|
545
545
|
deleted: "deleted";
|
|
@@ -613,8 +613,8 @@ export declare const SignedSnapshotPayloadSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
613
613
|
other: "other";
|
|
614
614
|
}>;
|
|
615
615
|
status: z.ZodEnum<{
|
|
616
|
-
proposed: "proposed";
|
|
617
616
|
active: "active";
|
|
617
|
+
proposed: "proposed";
|
|
618
618
|
suppressed: "suppressed";
|
|
619
619
|
superseded: "superseded";
|
|
620
620
|
deleted: "deleted";
|
|
@@ -691,14 +691,14 @@ export declare const SignedSnapshotPayloadSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
691
691
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
692
692
|
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
693
693
|
agent: z.ZodString;
|
|
694
|
-
eventId: z.ZodOptional<z.ZodUUID>;
|
|
695
694
|
messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
695
|
+
eventId: z.ZodOptional<z.ZodUUID>;
|
|
696
696
|
userId: z.ZodOptional<z.ZodUUID>;
|
|
697
697
|
redacted: z.ZodOptional<z.ZodBoolean>;
|
|
698
698
|
}, z.core.$strict>;
|
|
699
699
|
status: z.ZodEnum<{
|
|
700
|
-
proposed: "proposed";
|
|
701
700
|
active: "active";
|
|
701
|
+
proposed: "proposed";
|
|
702
702
|
suppressed: "suppressed";
|
|
703
703
|
superseded: "superseded";
|
|
704
704
|
deleted: "deleted";
|
|
@@ -856,8 +856,8 @@ export declare const ReliableObservationResponseSchema: z.ZodObject<{
|
|
|
856
856
|
other: "other";
|
|
857
857
|
}>;
|
|
858
858
|
status: z.ZodEnum<{
|
|
859
|
-
proposed: "proposed";
|
|
860
859
|
active: "active";
|
|
860
|
+
proposed: "proposed";
|
|
861
861
|
suppressed: "suppressed";
|
|
862
862
|
superseded: "superseded";
|
|
863
863
|
deleted: "deleted";
|
|
@@ -1093,8 +1093,8 @@ export declare const ReliableTurnResponseSchema: z.ZodObject<{
|
|
|
1093
1093
|
other: "other";
|
|
1094
1094
|
}>;
|
|
1095
1095
|
status: z.ZodEnum<{
|
|
1096
|
-
proposed: "proposed";
|
|
1097
1096
|
active: "active";
|
|
1097
|
+
proposed: "proposed";
|
|
1098
1098
|
suppressed: "suppressed";
|
|
1099
1099
|
superseded: "superseded";
|
|
1100
1100
|
deleted: "deleted";
|
|
@@ -1173,8 +1173,8 @@ export declare const ReliableTurnResponseSchema: z.ZodObject<{
|
|
|
1173
1173
|
other: "other";
|
|
1174
1174
|
}>;
|
|
1175
1175
|
status: z.ZodEnum<{
|
|
1176
|
-
proposed: "proposed";
|
|
1177
1176
|
active: "active";
|
|
1177
|
+
proposed: "proposed";
|
|
1178
1178
|
suppressed: "suppressed";
|
|
1179
1179
|
superseded: "superseded";
|
|
1180
1180
|
deleted: "deleted";
|
|
@@ -1248,8 +1248,8 @@ export declare const ReliableTurnResponseSchema: z.ZodObject<{
|
|
|
1248
1248
|
other: "other";
|
|
1249
1249
|
}>;
|
|
1250
1250
|
status: z.ZodEnum<{
|
|
1251
|
-
proposed: "proposed";
|
|
1252
1251
|
active: "active";
|
|
1252
|
+
proposed: "proposed";
|
|
1253
1253
|
suppressed: "suppressed";
|
|
1254
1254
|
superseded: "superseded";
|
|
1255
1255
|
deleted: "deleted";
|
|
@@ -1326,14 +1326,14 @@ export declare const ReliableTurnResponseSchema: z.ZodObject<{
|
|
|
1326
1326
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
1327
1327
|
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
1328
1328
|
agent: z.ZodString;
|
|
1329
|
-
eventId: z.ZodOptional<z.ZodUUID>;
|
|
1330
1329
|
messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1330
|
+
eventId: z.ZodOptional<z.ZodUUID>;
|
|
1331
1331
|
userId: z.ZodOptional<z.ZodUUID>;
|
|
1332
1332
|
redacted: z.ZodOptional<z.ZodBoolean>;
|
|
1333
1333
|
}, z.core.$strict>;
|
|
1334
1334
|
status: z.ZodEnum<{
|
|
1335
|
-
proposed: "proposed";
|
|
1336
1335
|
active: "active";
|
|
1336
|
+
proposed: "proposed";
|
|
1337
1337
|
suppressed: "suppressed";
|
|
1338
1338
|
superseded: "superseded";
|
|
1339
1339
|
deleted: "deleted";
|
|
@@ -1730,8 +1730,8 @@ export declare const ReliableContextDeliveryResponseSchema: z.ZodObject<{
|
|
|
1730
1730
|
other: "other";
|
|
1731
1731
|
}>;
|
|
1732
1732
|
status: z.ZodEnum<{
|
|
1733
|
-
proposed: "proposed";
|
|
1734
1733
|
active: "active";
|
|
1734
|
+
proposed: "proposed";
|
|
1735
1735
|
suppressed: "suppressed";
|
|
1736
1736
|
superseded: "superseded";
|
|
1737
1737
|
deleted: "deleted";
|
|
@@ -1805,8 +1805,8 @@ export declare const ReliableContextDeliveryResponseSchema: z.ZodObject<{
|
|
|
1805
1805
|
other: "other";
|
|
1806
1806
|
}>;
|
|
1807
1807
|
status: z.ZodEnum<{
|
|
1808
|
-
proposed: "proposed";
|
|
1809
1808
|
active: "active";
|
|
1809
|
+
proposed: "proposed";
|
|
1810
1810
|
suppressed: "suppressed";
|
|
1811
1811
|
superseded: "superseded";
|
|
1812
1812
|
deleted: "deleted";
|
|
@@ -1883,14 +1883,14 @@ export declare const ReliableContextDeliveryResponseSchema: z.ZodObject<{
|
|
|
1883
1883
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
1884
1884
|
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
1885
1885
|
agent: z.ZodString;
|
|
1886
|
-
eventId: z.ZodOptional<z.ZodUUID>;
|
|
1887
1886
|
messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1887
|
+
eventId: z.ZodOptional<z.ZodUUID>;
|
|
1888
1888
|
userId: z.ZodOptional<z.ZodUUID>;
|
|
1889
1889
|
redacted: z.ZodOptional<z.ZodBoolean>;
|
|
1890
1890
|
}, z.core.$strict>;
|
|
1891
1891
|
status: z.ZodEnum<{
|
|
1892
|
-
proposed: "proposed";
|
|
1893
1892
|
active: "active";
|
|
1893
|
+
proposed: "proposed";
|
|
1894
1894
|
suppressed: "suppressed";
|
|
1895
1895
|
superseded: "superseded";
|
|
1896
1896
|
deleted: "deleted";
|
|
@@ -2205,14 +2205,14 @@ export declare const ReliableGuardCheckResponseSchema: z.ZodObject<{
|
|
|
2205
2205
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
2206
2206
|
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
2207
2207
|
agent: z.ZodString;
|
|
2208
|
-
eventId: z.ZodOptional<z.ZodUUID>;
|
|
2209
2208
|
messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2209
|
+
eventId: z.ZodOptional<z.ZodUUID>;
|
|
2210
2210
|
userId: z.ZodOptional<z.ZodUUID>;
|
|
2211
2211
|
redacted: z.ZodOptional<z.ZodBoolean>;
|
|
2212
2212
|
}, z.core.$strict>;
|
|
2213
2213
|
status: z.ZodEnum<{
|
|
2214
|
-
proposed: "proposed";
|
|
2215
2214
|
active: "active";
|
|
2215
|
+
proposed: "proposed";
|
|
2216
2216
|
suppressed: "suppressed";
|
|
2217
2217
|
superseded: "superseded";
|
|
2218
2218
|
deleted: "deleted";
|
|
@@ -2390,8 +2390,8 @@ export declare const ObservationReliabilityResponseSchema: z.ZodObject<{
|
|
|
2390
2390
|
other: "other";
|
|
2391
2391
|
}>;
|
|
2392
2392
|
status: z.ZodEnum<{
|
|
2393
|
-
proposed: "proposed";
|
|
2394
2393
|
active: "active";
|
|
2394
|
+
proposed: "proposed";
|
|
2395
2395
|
suppressed: "suppressed";
|
|
2396
2396
|
superseded: "superseded";
|
|
2397
2397
|
deleted: "deleted";
|
|
@@ -2626,8 +2626,8 @@ export declare const TurnReliabilityResponseSchema: z.ZodObject<{
|
|
|
2626
2626
|
other: "other";
|
|
2627
2627
|
}>;
|
|
2628
2628
|
status: z.ZodEnum<{
|
|
2629
|
-
proposed: "proposed";
|
|
2630
2629
|
active: "active";
|
|
2630
|
+
proposed: "proposed";
|
|
2631
2631
|
suppressed: "suppressed";
|
|
2632
2632
|
superseded: "superseded";
|
|
2633
2633
|
deleted: "deleted";
|
|
@@ -2706,8 +2706,8 @@ export declare const TurnReliabilityResponseSchema: z.ZodObject<{
|
|
|
2706
2706
|
other: "other";
|
|
2707
2707
|
}>;
|
|
2708
2708
|
status: z.ZodEnum<{
|
|
2709
|
-
proposed: "proposed";
|
|
2710
2709
|
active: "active";
|
|
2710
|
+
proposed: "proposed";
|
|
2711
2711
|
suppressed: "suppressed";
|
|
2712
2712
|
superseded: "superseded";
|
|
2713
2713
|
deleted: "deleted";
|
|
@@ -2781,8 +2781,8 @@ export declare const TurnReliabilityResponseSchema: z.ZodObject<{
|
|
|
2781
2781
|
other: "other";
|
|
2782
2782
|
}>;
|
|
2783
2783
|
status: z.ZodEnum<{
|
|
2784
|
-
proposed: "proposed";
|
|
2785
2784
|
active: "active";
|
|
2785
|
+
proposed: "proposed";
|
|
2786
2786
|
suppressed: "suppressed";
|
|
2787
2787
|
superseded: "superseded";
|
|
2788
2788
|
deleted: "deleted";
|
|
@@ -2859,14 +2859,14 @@ export declare const TurnReliabilityResponseSchema: z.ZodObject<{
|
|
|
2859
2859
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
2860
2860
|
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
2861
2861
|
agent: z.ZodString;
|
|
2862
|
-
eventId: z.ZodOptional<z.ZodUUID>;
|
|
2863
2862
|
messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2863
|
+
eventId: z.ZodOptional<z.ZodUUID>;
|
|
2864
2864
|
userId: z.ZodOptional<z.ZodUUID>;
|
|
2865
2865
|
redacted: z.ZodOptional<z.ZodBoolean>;
|
|
2866
2866
|
}, z.core.$strict>;
|
|
2867
2867
|
status: z.ZodEnum<{
|
|
2868
|
-
proposed: "proposed";
|
|
2869
2868
|
active: "active";
|
|
2869
|
+
proposed: "proposed";
|
|
2870
2870
|
suppressed: "suppressed";
|
|
2871
2871
|
superseded: "superseded";
|
|
2872
2872
|
deleted: "deleted";
|
|
@@ -3262,8 +3262,8 @@ export declare const ContextDeliveryReliabilityResponseSchema: z.ZodObject<{
|
|
|
3262
3262
|
other: "other";
|
|
3263
3263
|
}>;
|
|
3264
3264
|
status: z.ZodEnum<{
|
|
3265
|
-
proposed: "proposed";
|
|
3266
3265
|
active: "active";
|
|
3266
|
+
proposed: "proposed";
|
|
3267
3267
|
suppressed: "suppressed";
|
|
3268
3268
|
superseded: "superseded";
|
|
3269
3269
|
deleted: "deleted";
|
|
@@ -3337,8 +3337,8 @@ export declare const ContextDeliveryReliabilityResponseSchema: z.ZodObject<{
|
|
|
3337
3337
|
other: "other";
|
|
3338
3338
|
}>;
|
|
3339
3339
|
status: z.ZodEnum<{
|
|
3340
|
-
proposed: "proposed";
|
|
3341
3340
|
active: "active";
|
|
3341
|
+
proposed: "proposed";
|
|
3342
3342
|
suppressed: "suppressed";
|
|
3343
3343
|
superseded: "superseded";
|
|
3344
3344
|
deleted: "deleted";
|
|
@@ -3415,14 +3415,14 @@ export declare const ContextDeliveryReliabilityResponseSchema: z.ZodObject<{
|
|
|
3415
3415
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
3416
3416
|
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
3417
3417
|
agent: z.ZodString;
|
|
3418
|
-
eventId: z.ZodOptional<z.ZodUUID>;
|
|
3419
3418
|
messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3419
|
+
eventId: z.ZodOptional<z.ZodUUID>;
|
|
3420
3420
|
userId: z.ZodOptional<z.ZodUUID>;
|
|
3421
3421
|
redacted: z.ZodOptional<z.ZodBoolean>;
|
|
3422
3422
|
}, z.core.$strict>;
|
|
3423
3423
|
status: z.ZodEnum<{
|
|
3424
|
-
proposed: "proposed";
|
|
3425
3424
|
active: "active";
|
|
3425
|
+
proposed: "proposed";
|
|
3426
3426
|
suppressed: "suppressed";
|
|
3427
3427
|
superseded: "superseded";
|
|
3428
3428
|
deleted: "deleted";
|
|
@@ -3735,14 +3735,14 @@ export declare const GuardCheckReliabilityResponseSchema: z.ZodObject<{
|
|
|
3735
3735
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
3736
3736
|
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
3737
3737
|
agent: z.ZodString;
|
|
3738
|
-
eventId: z.ZodOptional<z.ZodUUID>;
|
|
3739
3738
|
messageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3739
|
+
eventId: z.ZodOptional<z.ZodUUID>;
|
|
3740
3740
|
userId: z.ZodOptional<z.ZodUUID>;
|
|
3741
3741
|
redacted: z.ZodOptional<z.ZodBoolean>;
|
|
3742
3742
|
}, z.core.$strict>;
|
|
3743
3743
|
status: z.ZodEnum<{
|
|
3744
|
-
proposed: "proposed";
|
|
3745
3744
|
active: "active";
|
|
3745
|
+
proposed: "proposed";
|
|
3746
3746
|
suppressed: "suppressed";
|
|
3747
3747
|
superseded: "superseded";
|
|
3748
3748
|
deleted: "deleted";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ContextDeliveryRequest, type PairedTurnRequest } from "./pilot-schemas.js";
|
|
2
|
+
/**
|
|
3
|
+
* The context request a paired turn binds in its signed context snapshot.
|
|
4
|
+
*
|
|
5
|
+
* Clients verify the snapshot against the request they sent, so this must
|
|
6
|
+
* describe the retrieval the server actually ran for the turn: the enriched
|
|
7
|
+
* `task` when the client supplied one, otherwise the current user message.
|
|
8
|
+
*/
|
|
9
|
+
export declare function contextRequestFromTurn(request: PairedTurnRequest): ContextDeliveryRequest;
|
|
10
|
+
//# sourceMappingURL=turn-context-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-context-request.d.ts","sourceRoot":"","sources":["../src/turn-context-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAG5B;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,iBAAiB,GACzB,sBAAsB,CAiBxB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ContextDeliveryRequestSchema, } from "./pilot-schemas.js";
|
|
2
|
+
import { redactUnknown } from "./redaction.js";
|
|
3
|
+
/**
|
|
4
|
+
* The context request a paired turn binds in its signed context snapshot.
|
|
5
|
+
*
|
|
6
|
+
* Clients verify the snapshot against the request they sent, so this must
|
|
7
|
+
* describe the retrieval the server actually ran for the turn: the enriched
|
|
8
|
+
* `task` when the client supplied one, otherwise the current user message.
|
|
9
|
+
*/
|
|
10
|
+
export function contextRequestFromTurn(request) {
|
|
11
|
+
const draft = {
|
|
12
|
+
connector: request.connector,
|
|
13
|
+
eventId: request.eventId,
|
|
14
|
+
sessionId: request.sessionId,
|
|
15
|
+
...(request.retainedReceiptIds === undefined ? {} : { retainedReceiptIds: request.retainedReceiptIds }),
|
|
16
|
+
task: {
|
|
17
|
+
agent: request.agent,
|
|
18
|
+
task: request.task ?? request.currentUser.content,
|
|
19
|
+
// Turn parsing always materializes a scope object; a client that sent none
|
|
20
|
+
// binds none, so an empty scope must not appear in the signed request.
|
|
21
|
+
...(request.scope === undefined || Object.keys(request.scope).length === 0
|
|
22
|
+
? {}
|
|
23
|
+
: { scope: request.scope }),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return ContextDeliveryRequestSchema.parse(redactUnknown(draft).value);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=turn-context-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-context-request.js","sourceRoot":"","sources":["../src/turn-context-request.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,GAG7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAA0B;IAE1B,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,GAAG,CAAC,OAAO,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE,CAAC;QACvG,IAAI,EAAE;YACJ,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,OAAO;YACjD,2EAA2E;YAC3E,uEAAuE;YACvE,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC;gBACxE,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;SAC9B;KACF,CAAC;IACF,OAAO,4BAA4B,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC"}
|
package/dist/user-message.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export declare function isQuestionReplyMessage(text: string): boolean;
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Extract user text for display and summaries without changing the recorded
|
|
4
|
+
* message. Leading host envelopes are metadata; a side-session brief keeps only
|
|
5
|
+
* its task; Codex diff-comment framing and Copilot review wrappers give way to
|
|
6
|
+
* the reviewer's words; inline references show their label and pasted text
|
|
7
|
+
* loses its wrapper. Anything else, including quoted examples, stays intact.
|
|
8
|
+
*/
|
|
3
9
|
export declare function userMessageText(text: string): string;
|
|
4
10
|
/** Deliberately narrow: an explicit task such as "Fix billing" starts a new subject. */
|
|
5
11
|
export declare function isTaskFollowUp(text: string): boolean;
|
|
@@ -8,6 +14,8 @@ export declare function retrievalTaskText(text: string): string;
|
|
|
8
14
|
/**
|
|
9
15
|
* Human evidence for learning extraction. This never changes stored source text.
|
|
10
16
|
* Host notices may use the user role, but cannot establish a human decision.
|
|
17
|
+
* Leading notices are removed with the other host envelopes; later ones here.
|
|
18
|
+
* A review wrapper without a recoverable comment has no human words at all.
|
|
11
19
|
*/
|
|
12
20
|
export declare function learningMessageText(source: string): string;
|
|
13
21
|
//# sourceMappingURL=user-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-message.d.ts","sourceRoot":"","sources":["../src/user-message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user-message.d.ts","sourceRoot":"","sources":["../src/user-message.ts"],"names":[],"mappings":"AAWA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBpD;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMpD;AAED,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CActD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG1D"}
|
package/dist/user-message.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const closingTag = "</in-app-browser-context>";
|
|
8
|
-
const closing = text.indexOf(closingTag, opening[0].length);
|
|
9
|
-
// Older titles may have been truncated inside the envelope. Let the caller
|
|
10
|
-
// use its normal fallback instead of presenting metadata as the user's task.
|
|
11
|
-
if (closing === -1)
|
|
12
|
-
return "";
|
|
13
|
-
return text.slice(closing + closingTag.length)
|
|
14
|
-
.replace(/^(?:[ \t]*\r?\n)+/u, "")
|
|
15
|
-
.replace(/^ {0,3}## My request:[ \t]*(?:\r?\n|$)/u, "")
|
|
16
|
-
.replace(/^(?:[ \t]*\r?\n)+/u, "");
|
|
17
|
-
}
|
|
1
|
+
import { HOST_ENVELOPES, reviewRequestComment, isReviewRequest, withLabeledAnnotations, withoutDiffCommentMetadata, withoutHostNotices, withoutInlineWrappers, withoutLeadingHostEnvelopes, withoutSideSessionBrief, } from "./host-envelopes.js";
|
|
2
|
+
// Codex delivers answers to a question the agent asked as JSON inside a
|
|
3
|
+
// transport tag. Known wrappers are declared once in host-envelopes.ts.
|
|
4
|
+
const questionReplyTag = HOST_ENVELOPES.find(envelope => envelope.id === "codex-question-reply").tag;
|
|
5
|
+
const questionReplyStart = new RegExp(String.raw `^(?:[ \t]*\r?\n)* {0,3}<${questionReplyTag}>`, "u");
|
|
6
|
+
const questionReplyBody = new RegExp(String.raw `^\s*<${questionReplyTag}>\s*([\s\S]*?)\s*</${questionReplyTag}>\.?\s*$`, "u");
|
|
18
7
|
export function isQuestionReplyMessage(text) {
|
|
19
|
-
return questionReplyStart.test(
|
|
8
|
+
return questionReplyStart.test(withoutLeadingHostEnvelopes(text));
|
|
20
9
|
}
|
|
21
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Extract user text for display and summaries without changing the recorded
|
|
12
|
+
* message. Leading host envelopes are metadata; a side-session brief keeps only
|
|
13
|
+
* its task; Codex diff-comment framing and Copilot review wrappers give way to
|
|
14
|
+
* the reviewer's words; inline references show their label and pasted text
|
|
15
|
+
* loses its wrapper. Anything else, including quoted examples, stays intact.
|
|
16
|
+
*/
|
|
22
17
|
export function userMessageText(text) {
|
|
23
|
-
text =
|
|
24
|
-
if (!questionReplyStart.test(text))
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
text = withoutSideSessionBrief(withoutLeadingHostEnvelopes(text));
|
|
19
|
+
if (!questionReplyStart.test(text)) {
|
|
20
|
+
text = withLabeledAnnotations(withoutInlineWrappers(withoutDiffCommentMetadata(text)));
|
|
21
|
+
// Without a recoverable comment the wrapper stays visible rather than
|
|
22
|
+
// hiding text that may be the user's.
|
|
23
|
+
return reviewRequestComment(text) || text;
|
|
24
|
+
}
|
|
25
|
+
const body = questionReplyBody.exec(text)?.[1];
|
|
27
26
|
if (!body)
|
|
28
27
|
return "";
|
|
29
28
|
try {
|
|
@@ -71,20 +70,11 @@ export function retrievalTaskText(text) {
|
|
|
71
70
|
/**
|
|
72
71
|
* Human evidence for learning extraction. This never changes stored source text.
|
|
73
72
|
* Host notices may use the user role, but cannot establish a human decision.
|
|
73
|
+
* Leading notices are removed with the other host envelopes; later ones here.
|
|
74
|
+
* A review wrapper without a recoverable comment has no human words at all.
|
|
74
75
|
*/
|
|
75
76
|
export function learningMessageText(source) {
|
|
76
|
-
const text = userMessageText(source);
|
|
77
|
-
|
|
78
|
-
const examples = [...text.matchAll(/```[\s\S]*?```|~~~[\s\S]*?~~~|`[^`\n]*`|^ {4}[^\n]*|^ {0,3}>[^\n]*/gmu)]
|
|
79
|
-
.map(match => [match.index, match.index + match[0].length]);
|
|
80
|
-
const protectedAt = (offset) => examples.some(([start, end]) => offset >= start && offset < end);
|
|
81
|
-
const cleaned = text.replace(/<(coordination_revocation|system_notification|cross_session_message)\b[^>]*>(?:[\s\S]*?<\/\1>|[\s\S]*$)|<copilot-ref\b[^>]*\/>/gu, (match, _tag, offset) => protectedAt(offset) ? match : match.startsWith("<copilot-ref") ? /\blabel="([^"]*)"/u.exec(match)?.[1] ?? "" : "").trim();
|
|
82
|
-
if (!cleaned.startsWith("[INLINE CODE REVIEW REQUEST]"))
|
|
83
|
-
return cleaned;
|
|
84
|
-
// The wrapper's instruction and identifiers are not the reviewer's feedback.
|
|
85
|
-
const comment = /(?:^|\n)[ \t]*(?:(?:User|Review)\s+)?Comment(?:\s+(?:body|text))?:[ \t]*([\s\S]*)$/imu.exec(cleaned)?.[1];
|
|
86
|
-
if (!comment)
|
|
87
|
-
return "";
|
|
88
|
-
return comment.split(/\n[ \t]*(?:Selected lines|Diff|Thread ID|Comment ID|Thread source):/iu)[0].trim();
|
|
77
|
+
const text = withoutHostNotices(userMessageText(source)).trim();
|
|
78
|
+
return isReviewRequest(text) ? reviewRequestComment(text) ?? "" : text;
|
|
89
79
|
}
|
|
90
80
|
//# sourceMappingURL=user-message.js.map
|
package/dist/user-message.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-message.js","sourceRoot":"","sources":["../src/user-message.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"user-message.js","sourceRoot":"","sources":["../src/user-message.ts"],"names":[],"mappings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I,CAAC;AACzE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lore-co/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "Schemas and primitives for auditable Lore engineering memory",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"types": "./dist/learning-titles.d.ts",
|
|
11
11
|
"import": "./dist/learning-titles.js"
|
|
12
12
|
},
|
|
13
|
+
"./session-titles": {
|
|
14
|
+
"types": "./dist/session-titles.d.ts",
|
|
15
|
+
"import": "./dist/session-titles.js"
|
|
16
|
+
},
|
|
13
17
|
"./capture-conflict": {
|
|
14
18
|
"types": "./dist/capture-conflict.d.ts",
|
|
15
19
|
"import": "./dist/capture-conflict.js"
|
|
@@ -58,6 +62,10 @@
|
|
|
58
62
|
"types": "./dist/user-message.d.ts",
|
|
59
63
|
"import": "./dist/user-message.js"
|
|
60
64
|
},
|
|
65
|
+
"./host-envelopes": {
|
|
66
|
+
"types": "./dist/host-envelopes.d.ts",
|
|
67
|
+
"import": "./dist/host-envelopes.js"
|
|
68
|
+
},
|
|
61
69
|
"./session-purpose": {
|
|
62
70
|
"types": "./dist/session-purpose.d.ts",
|
|
63
71
|
"import": "./dist/session-purpose.js"
|