@larkup/tool-video-intelligence 0.3.7 → 0.3.9

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.js CHANGED
@@ -31,7 +31,7 @@ export const AGENT_TOOLS = [
31
31
  scope: { type: 'string', enum: ['focused', 'temporal', 'source'] },
32
32
  goal: {
33
33
  type: 'string',
34
- enum: ['answer', 'compare', 'trace', 'enumerate', 'synthesize'],
34
+ enum: ['answer', 'compare', 'trace', 'resolve', 'enumerate', 'synthesize'],
35
35
  },
36
36
  evidence: {
37
37
  type: 'array',
@@ -61,7 +61,7 @@ export const AGENT_TOOLS = [
61
61
  method: 'queryVideoEvidence',
62
62
  workflow: 'evidence-query',
63
63
  evidenceInput: 'media-asset',
64
- systemPromptFragment: 'Use this action for media questions. On every call, derive investigation from the user’s meaning in their own language: use focused for one local moment, temporal for a relationship or development across moments, and source when the answer must account for the recording as a whole. Set answer, compare, trace, enumerate, or synthesize according to the reasoning operation—not the video genre or a word list. If the user supplies a specific source time or range, put its resolved seconds in investigation.timeRange; otherwise omit it. For a source enumeration, set recordSet to source-authored for units authored in the recording, source-questions for only authored questions and their answers, observed for time-grounded observed facts, or all when both are needed. For exact spoken or sung wording across the recording, use source plus enumerate, speech evidence, and recordSet all. Choose source plus synthesize for the overall narrative. Focused questions use ranked evidence; source enumerations use a chronological database scan; source explanations use a durable navigation aggregate. Never turn a complete-source request into top-K retrieval. For an exhaustive result, follow continuation.nextCursor until hasMore=false; do not mistake one page for the complete answer. Answer in the returned sourceLanguage by default, including notes, speech, and lyrics; translate only when the user explicitly asks. Never default to English. Never say you do not know or that the source lacks an answer before this action has attempted its available fallback. State a value, identity, count, or exact visible fact only when established. observedSubjects, when present, is the reconciled frame-grounded visibility ledger: use its ranges for visible-presence and timing claims, never speech, titles, or a source name. Its durations are observed intervals, not inferred continuous screen time. Answer as a viewer who remembers the material: lead with the answer itself, and when natural say "I saw" or "I heard" rather than describing a system. Do not say "the video shows", "the analysis indicates", or "according to retrieved evidence". Never mention retrieval, search, indexing, frames, tools, or analysis unless the user asks how the answer was found.',
64
+ systemPromptFragment: 'Use this action for media questions. On every call, derive investigation from the user’s meaning in their own language: use focused for one local moment, temporal for a relationship or development across moments, and source when the answer must account for the recording as a whole. Set answer, compare, trace, enumerate, or synthesize according to the reasoning operation—not the video genre or a word list. If the user supplies a specific source time or range, put its resolved seconds in investigation.timeRange; otherwise omit it. Use recordSet observed only when the requested answer is the visible presence, recurrence, or timing ledger itself; never use it for clothing, colour, appearance attributes, identity, action, or another visual fact. For a source enumeration, set recordSet to source-authored for units authored in the recording, source-questions for only authored questions and their answers, observed for time-grounded observed facts, or all when both are needed. For exact spoken or sung wording across the recording, use source plus enumerate, speech evidence, and recordSet all. Choose source plus synthesize for the overall narrative. Focused questions use ranked evidence; source enumerations use a chronological database scan; source explanations use a durable navigation aggregate. Never turn a complete-source request into top-K retrieval. For an exhaustive result, follow continuation.nextCursor until hasMore=false; do not mistake one page for the complete answer. Answer in the returned sourceLanguage by default, including notes, speech, and lyrics; translate only when the user explicitly asks. Never default to English. Never say you do not know or that the source lacks an answer before this action has attempted its available fallback. State a value, identity, count, or exact visible fact only when established. observedSubjects, when present, is the reconciled frame-grounded visibility ledger: use its ranges for visible-presence and timing claims, never speech, titles, or a source name. Its durations are observed intervals, not inferred continuous screen time. Answer as a viewer who remembers the material: lead with the answer itself, and when natural say "I saw" or "I heard" rather than describing a system. Do not say "the video shows", "the analysis indicates", or "according to retrieved evidence". Never mention retrieval, search, indexing, frames, tools, or analysis unless the user asks how the answer was found.',
65
65
  },
66
66
  {
67
67
  name: 'inspectVideoKnowledge',
@@ -1177,11 +1177,13 @@ function indexedReconciledAnswerHits(hits, plan, durationSecs) {
1177
1177
  const semantic = Number(hit.components?.semantic ?? 0);
1178
1178
  const lexical = Number(hit.components?.lexical ?? 0);
1179
1179
  const text = evidenceText(hit.evidence.payload).trim();
1180
+ const visibilityLedger = /^Reconciled visible subject:/i.test(text);
1180
1181
  return (provider === 'video-intelligence-index' &&
1181
1182
  hit.evidence.modality === 'computed' &&
1182
1183
  confidence >= 0.5 &&
1183
1184
  text.length >= 20 &&
1184
1185
  (semantic >= 0.05 || lexical >= 0.2) &&
1186
+ (!visibilityLedger || usesObservedVisibilityLedger(plan)) &&
1185
1187
  !hasNegativeVerdict(hit) &&
1186
1188
  !hasNegativeVerdict(hit) &&
1187
1189
  !spansWholeSource(hit, durationSecs));
@@ -2221,7 +2223,8 @@ function isIndexedDirectObservation(hit, question, plan) {
2221
2223
  // observation protocol and is precisely the merged record required for an
2222
2224
  // appearance/timing answer. Keeping this exception protocol-bound prevents
2223
2225
  // an arbitrary computed summary from bypassing source corroboration.
2224
- const reconciledVisibility = hit.evidence.modality === 'computed' &&
2226
+ const reconciledVisibility = usesObservedVisibilityLedger(plan) &&
2227
+ hit.evidence.modality === 'computed' &&
2225
2228
  /^Reconciled visible subject:\s*[^\n]+\nIdentity basis:\s*(?:source-named|source-described|unresolved)\nObserved appearances:\s*\d/im.test(text);
2226
2229
  if (!['transcript', 'ocr', 'visual'].includes(hit.evidence.modality) && !reconciledVisibility)
2227
2230
  return false;
@@ -2252,7 +2255,11 @@ function isIndexedDirectObservation(hit, question, plan) {
2252
2255
  return false;
2253
2256
  const requestedRanges = directiveTimeRange(plan?.investigation, undefined);
2254
2257
  const establishedRanges = reconciledVisibility ? observedAppearanceRanges(text) : [];
2258
+ const tracesObservedVisibility = reconciledVisibility &&
2259
+ plan?.investigation?.recordSet === 'observed' &&
2260
+ plan.investigation.goal === 'trace';
2255
2261
  if (requestedRanges.length > 0 &&
2262
+ !tracesObservedVisibility &&
2256
2263
  !(establishedRanges.length > 0 ? establishedRanges : [hit.evidence.timeRange]).some((candidate) => requestedRanges.some((range) => candidate.startSecs < range.endSecs && candidate.endSecs > range.startSecs))) {
2257
2264
  return false;
2258
2265
  }
@@ -2284,6 +2291,11 @@ function isIndexedDirectObservation(hit, question, plan) {
2284
2291
  .match(/[\p{Letter}\p{Number}][\p{Letter}\p{Number}\p{Mark}_-]*/gu) ?? []);
2285
2292
  return [...questionTerms].some((term) => sourceTerms.has(term));
2286
2293
  }
2294
+ /** A visibility aggregate is answer data only when the planner requested that exact record set. */
2295
+ function usesObservedVisibilityLedger(plan) {
2296
+ return (plan?.investigation?.recordSet === 'observed' ||
2297
+ (plan?.investigation?.scope === 'focused' && Boolean(plan.investigation.timeRange)));
2298
+ }
2287
2299
  /** Read only the visibility-ledger protocol's explicit intervals. */
2288
2300
  function observedAppearanceRanges(text) {
2289
2301
  const appearances = text.match(/^Observed appearances:\s*([^\n]+)/im)?.[1];
@@ -2407,7 +2419,7 @@ function validInvestigation(value) {
2407
2419
  const directive = value;
2408
2420
  const timeRange = directive.timeRange;
2409
2421
  return (['focused', 'temporal', 'source'].includes(String(directive.scope)) &&
2410
- ['answer', 'compare', 'trace', 'enumerate', 'synthesize'].includes(String(directive.goal)) &&
2422
+ ['answer', 'compare', 'trace', 'resolve', 'enumerate', 'synthesize'].includes(String(directive.goal)) &&
2411
2423
  (directive.recordSet === undefined ||
2412
2424
  ['all', 'source-authored', 'source-questions', 'observed'].includes(directive.recordSet)) &&
2413
2425
  (timeRange === undefined ||
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export * from './ui.js';
9
9
  export declare const TOOL_META: {
10
10
  readonly id: "video-intelligence";
11
11
  readonly name: "Video Intelligence";
12
- readonly version: "0.3.7";
12
+ readonly version: "0.3.9";
13
13
  };
14
14
  export declare const TOOL_EXTENSION: {
15
15
  id: "video-intelligence";
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ export * from './ui.js';
11
11
  export const TOOL_META = {
12
12
  id: 'video-intelligence',
13
13
  name: 'Video Intelligence',
14
- version: '0.3.7',
14
+ version: '0.3.9',
15
15
  };
16
16
  /** Managed infrastructure stays an implementation detail of Larkup Cloud. */
17
17
  const MANAGED_CLOUD_ENDPOINT = process.env.LARKUP_VIDEO_INTELLIGENCE_CLOUD_ENDPOINT ??
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@larkup/tool-video-intelligence",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "type": "module",
5
5
  "description": "Installable local and cloud video intelligence with evidence-first indexing.",
6
6
  "main": "./dist/index.js",
@@ -56,13 +56,13 @@
56
56
  }
57
57
  },
58
58
  "dependencies": {
59
- "@larkup/core": "0.8.1"
59
+ "@larkup/core": "0.8.2"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "^26",
63
63
  "typescript": "^7.0.2",
64
64
  "vitest": "^5.0.0",
65
- "@larkup/marketplace": "0.3.10"
65
+ "@larkup/marketplace": "0.3.11"
66
66
  },
67
67
  "publishConfig": {
68
68
  "access": "public"
@@ -7,7 +7,7 @@
7
7
  "description": "Help your AI understand your videos, so you can ask questions and get answers from the right moments.",
8
8
  "longDescription": "Turn videos into knowledge your AI can understand. It listens to what is said, reads what appears on screen, and helps you find the moments that matter.",
9
9
  "category": "media",
10
- "version": "0.3.7",
10
+ "version": "0.3.9",
11
11
  "pricing": "free",
12
12
  "emoji": "🎥",
13
13
  "icon": "Film",