@stigmer/react-core 0.3.2 → 0.4.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/README.md +1 -1
- package/agent/useAgentVersions.d.ts +76 -0
- package/agent/useAgentVersions.d.ts.map +1 -0
- package/agent/useAgentVersions.js +120 -0
- package/agent/useAgentVersions.js.map +1 -0
- package/file/useSessionFiles.d.ts +55 -0
- package/file/useSessionFiles.d.ts.map +1 -0
- package/file/useSessionFiles.js +113 -0
- package/file/useSessionFiles.js.map +1 -0
- package/index.d.ts +12 -0
- package/index.d.ts.map +1 -1
- package/index.js +6 -0
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/run/deriveRunFileChanges.d.ts +31 -0
- package/run/deriveRunFileChanges.d.ts.map +1 -0
- package/run/deriveRunFileChanges.js +124 -0
- package/run/deriveRunFileChanges.js.map +1 -0
- package/run/tool-categories.d.ts +3 -1
- package/run/tool-categories.d.ts.map +1 -1
- package/run/useAnswerCustomToolUse.d.ts +62 -0
- package/run/useAnswerCustomToolUse.d.ts.map +1 -0
- package/run/useAnswerCustomToolUse.js +67 -0
- package/run/useAnswerCustomToolUse.js.map +1 -0
- package/run/useCreateRun.d.ts +9 -1
- package/run/useCreateRun.d.ts.map +1 -1
- package/run/useCreateRun.js +1 -0
- package/run/useCreateRun.js.map +1 -1
- package/session/useSessionConversation.d.ts +19 -0
- package/session/useSessionConversation.d.ts.map +1 -1
- package/session/useSessionConversation.js +12 -0
- package/session/useSessionConversation.js.map +1 -1
- package/session/useSessionFileChanges.d.ts +47 -0
- package/session/useSessionFileChanges.d.ts.map +1 -0
- package/session/useSessionFileChanges.js +46 -0
- package/session/useSessionFileChanges.js.map +1 -0
- package/session/useSessionOutputs.d.ts +71 -0
- package/session/useSessionOutputs.d.ts.map +1 -0
- package/session/useSessionOutputs.js +113 -0
- package/session/useSessionOutputs.js.map +1 -0
- package/src/agent/useAgentVersions.ts +186 -0
- package/src/file/useSessionFiles.ts +144 -0
- package/src/index.ts +12 -0
- package/src/run/deriveRunFileChanges.ts +135 -0
- package/src/run/tool-categories.ts +1 -1
- package/src/run/useAnswerCustomToolUse.ts +119 -0
- package/src/run/useCreateRun.ts +10 -1
- package/src/session/useSessionConversation.ts +43 -0
- package/src/session/useSessionFileChanges.ts +67 -0
- package/src/session/useSessionOutputs.ts +167 -0
- package/src/test/samples.ts +30 -0
- package/src/version-history/version-entry.ts +41 -0
- package/test/samples.d.ts +11 -0
- package/test/samples.d.ts.map +1 -1
- package/test/samples.js +28 -0
- package/test/samples.js.map +1 -1
- package/version-history/version-entry.d.ts +37 -0
- package/version-history/version-entry.d.ts.map +1 -0
- package/version-history/version-entry.js +6 -0
- package/version-history/version-entry.js.map +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @stigmer/react-core
|
|
2
2
|
|
|
3
|
-
React hooks for [Stigmer](https://stigmer.ai), the open-source backend for the agents in your product. This is the conversation layer of Stigmer's React kits: the client context, the fetch cache, and the hooks that start a run, follow a session, answer an approval
|
|
3
|
+
React hooks for [Stigmer](https://stigmer.ai), the open-source backend for the agents in your product. This is the conversation layer of Stigmer's React kits: the client context, the fetch cache, and the hooks that start a run, follow a session, answer an approval, review a file change and list the files a conversation made, with nothing that draws. A chat that does not render HTML (a terminal, a native app) builds on this package alone; [`@stigmer/react-sdk`](../react/README.md) builds its components over it, and [`@stigmer/ink-ui`](../ink/) its terminal views.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { AgentSpec } from "@stigmer/apis/ai/stigmer/agentic/agent/v1/spec_pb";
|
|
2
|
+
import type { VersionEntry } from "../version-history/version-entry.js";
|
|
3
|
+
/** Return value of {@link useAgentVersions}. */
|
|
4
|
+
export interface UseAgentVersionsReturn {
|
|
5
|
+
/** Version entries mapped to the generic timeline format (newest first). */
|
|
6
|
+
readonly versions: readonly VersionEntry[];
|
|
7
|
+
/** `true` when the agent has no recorded version yet. */
|
|
8
|
+
readonly isEmpty: boolean;
|
|
9
|
+
/** `true` while the initial fetch is in flight. */
|
|
10
|
+
readonly isLoading: boolean;
|
|
11
|
+
/** Error from the last failed request, or `null`. */
|
|
12
|
+
readonly error: Error | null;
|
|
13
|
+
/** Discard cached data and re-fetch from the server. */
|
|
14
|
+
readonly refetch: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* The spec a version stored, by its hash: what a turn recorded on that
|
|
17
|
+
* version runs. `null` for a hash the loaded pages do not hold.
|
|
18
|
+
*/
|
|
19
|
+
readonly getSpec: (versionHash: string) => AgentSpec | null;
|
|
20
|
+
/** `true` while the server holds entries beyond those loaded. */
|
|
21
|
+
readonly hasMore: boolean;
|
|
22
|
+
/** Load the next page. No-op while one is loading or when nothing follows. */
|
|
23
|
+
readonly loadMore: () => void;
|
|
24
|
+
/** `true` while a `loadMore` read is in flight. */
|
|
25
|
+
readonly isLoadingMore: boolean;
|
|
26
|
+
/** Error from the last failed `loadMore`, or `null`. */
|
|
27
|
+
readonly loadMoreError: Error | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Data hook that fetches an agent's version history.
|
|
31
|
+
*
|
|
32
|
+
* Every apply that changes an agent records a version under its content
|
|
33
|
+
* hash; this hook pages the `listVersions` RPC (newest first, `hasMore` /
|
|
34
|
+
* `loadMore` for older ones) and maps each entry to the
|
|
35
|
+
* generic {@link VersionEntry} every version timeline draws, keeping
|
|
36
|
+
* each version's full spec for {@link UseAgentVersionsReturn.getSpec}.
|
|
37
|
+
*
|
|
38
|
+
* An agent last written before agents were versioned has no history until
|
|
39
|
+
* its next apply: `versions` is empty and `isEmpty` is `true`.
|
|
40
|
+
*
|
|
41
|
+
* Pass `null` for `org` or `slug` to skip fetching (stable no-op).
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* function AgentHistory() {
|
|
46
|
+
* const { versions, isEmpty } = useAgentVersions("acme", "variance-reporter");
|
|
47
|
+
* if (isEmpty) return <p>No versions yet</p>;
|
|
48
|
+
* return (
|
|
49
|
+
* <ul>
|
|
50
|
+
* {versions.map((v) => (
|
|
51
|
+
* <li key={v.id}>{v.tag ?? v.label}</li>
|
|
52
|
+
* ))}
|
|
53
|
+
* </ul>
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function useAgentVersions(org: string | null, slug: string | null): UseAgentVersionsReturn;
|
|
59
|
+
/**
|
|
60
|
+
* How a version reads to a person: its tag when it has one, else the
|
|
61
|
+
* short hash the Versions tab shows. `versions` is the agent's history as
|
|
62
|
+
* {@link useAgentVersions} returns it; a hash it does not hold (still
|
|
63
|
+
* loading, or a history the viewer cannot read) reads as its short hash.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* import type { Run } from "@stigmer/apis/ai/stigmer/agentic/run/v1/api_pb";
|
|
68
|
+
*
|
|
69
|
+
* function RunVersion({ run }: { run: Run }) {
|
|
70
|
+
* const { versions } = useAgentVersions("acme", "reviewer");
|
|
71
|
+
* return <span>{agentVersionLabel(versions, run.status?.agentVersionHash ?? "")}</span>; // "v2" or "3f2a9c1e0b7d"
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function agentVersionLabel(versions: readonly VersionEntry[], versionHash: string): string;
|
|
76
|
+
//# sourceMappingURL=useAgentVersions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgentVersions.d.ts","sourceRoot":"","sources":["../src/agent/useAgentVersions.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mDAAmD,CAAC;AAOnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAExE,gDAAgD;AAChD,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,SAAS,GAAG,IAAI,CAAC;IAC5D,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,mDAAmD;IACnD,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,wDAAwD;IACxD,QAAQ,CAAC,aAAa,EAAE,KAAK,GAAG,IAAI,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,IAAI,EAAE,MAAM,GAAG,IAAI,GAClB,sBAAsB,CAsDxB;AAKD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,SAAS,YAAY,EAAE,EACjC,WAAW,EAAE,MAAM,GAClB,MAAM,CAGR"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// An agent's version history and how a version reads to a person. Every
|
|
3
|
+
// apply that changes an agent records a version under its content hash, and
|
|
4
|
+
// each turn of a conversation records the version it ran
|
|
5
|
+
// (`RunStatus.agent_version_hash`); a host that draws its own chat reads the
|
|
6
|
+
// history here and words a turn's version with `agentVersionLabel` ("v2",
|
|
7
|
+
// else a short hash), with no rendering package. The React kit's Versions
|
|
8
|
+
// tab, quality report and session view draw from the same two names.
|
|
9
|
+
//
|
|
10
|
+
// The history is mapped to `VersionEntry`, the timeline shape every
|
|
11
|
+
// versioned resource shares, so the kit's `VersionTimeline` draws it as is;
|
|
12
|
+
// the full spec of each version stays reachable by hash through `getSpec`.
|
|
13
|
+
// Tests: ./__tests__/useAgentVersions.test.tsx.
|
|
14
|
+
import { useCallback, useMemo } from "react";
|
|
15
|
+
import { create } from "@bufbuild/protobuf";
|
|
16
|
+
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
17
|
+
import { ListAgentVersionsInputSchema, } from "@stigmer/apis/ai/stigmer/agentic/agent/v1/version_pb";
|
|
18
|
+
import { useStigmer } from "../hooks.js";
|
|
19
|
+
import { useCursorPages } from "../internal/useCursorPages.js";
|
|
20
|
+
/**
|
|
21
|
+
* Data hook that fetches an agent's version history.
|
|
22
|
+
*
|
|
23
|
+
* Every apply that changes an agent records a version under its content
|
|
24
|
+
* hash; this hook pages the `listVersions` RPC (newest first, `hasMore` /
|
|
25
|
+
* `loadMore` for older ones) and maps each entry to the
|
|
26
|
+
* generic {@link VersionEntry} every version timeline draws, keeping
|
|
27
|
+
* each version's full spec for {@link UseAgentVersionsReturn.getSpec}.
|
|
28
|
+
*
|
|
29
|
+
* An agent last written before agents were versioned has no history until
|
|
30
|
+
* its next apply: `versions` is empty and `isEmpty` is `true`.
|
|
31
|
+
*
|
|
32
|
+
* Pass `null` for `org` or `slug` to skip fetching (stable no-op).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* function AgentHistory() {
|
|
37
|
+
* const { versions, isEmpty } = useAgentVersions("acme", "variance-reporter");
|
|
38
|
+
* if (isEmpty) return <p>No versions yet</p>;
|
|
39
|
+
* return (
|
|
40
|
+
* <ul>
|
|
41
|
+
* {versions.map((v) => (
|
|
42
|
+
* <li key={v.id}>{v.tag ?? v.label}</li>
|
|
43
|
+
* ))}
|
|
44
|
+
* </ul>
|
|
45
|
+
* );
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export function useAgentVersions(org, slug) {
|
|
50
|
+
const stigmer = useStigmer();
|
|
51
|
+
const pages = useCursorPages(org && slug
|
|
52
|
+
? (pageToken) => stigmer.agent.listVersions(create(ListAgentVersionsInputSchema, { org, slug, pageToken }))
|
|
53
|
+
: null, [org, slug, stigmer], (entry) => entry.versionHash);
|
|
54
|
+
const rawVersions = pages.items;
|
|
55
|
+
const { hasMore, loadMore, isLoadingMore, loadMoreError, isLoading, error, refetch } = pages;
|
|
56
|
+
const versions = useMemo(() => rawVersions.map(mapProtoToVersionEntry), [rawVersions]);
|
|
57
|
+
const specByHash = useMemo(() => {
|
|
58
|
+
const map = new Map();
|
|
59
|
+
for (const entry of rawVersions) {
|
|
60
|
+
if (entry.versionHash !== "" && entry.specSnapshot !== undefined) {
|
|
61
|
+
map.set(entry.versionHash, entry.specSnapshot);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return map;
|
|
65
|
+
}, [rawVersions]);
|
|
66
|
+
const getSpec = useCallback((versionHash) => specByHash.get(versionHash) ?? null, [specByHash]);
|
|
67
|
+
const isEmpty = versions.length === 0;
|
|
68
|
+
return useMemo(() => ({
|
|
69
|
+
versions,
|
|
70
|
+
isEmpty,
|
|
71
|
+
hasMore,
|
|
72
|
+
loadMore,
|
|
73
|
+
isLoadingMore,
|
|
74
|
+
loadMoreError,
|
|
75
|
+
isLoading,
|
|
76
|
+
error,
|
|
77
|
+
refetch,
|
|
78
|
+
getSpec,
|
|
79
|
+
}), [versions, isEmpty, hasMore, loadMore, isLoadingMore, loadMoreError, isLoading, error, refetch, getSpec]);
|
|
80
|
+
}
|
|
81
|
+
/** How many hex characters of a version hash a label shows. */
|
|
82
|
+
const SHORT_HASH_LENGTH = 12;
|
|
83
|
+
/**
|
|
84
|
+
* How a version reads to a person: its tag when it has one, else the
|
|
85
|
+
* short hash the Versions tab shows. `versions` is the agent's history as
|
|
86
|
+
* {@link useAgentVersions} returns it; a hash it does not hold (still
|
|
87
|
+
* loading, or a history the viewer cannot read) reads as its short hash.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* import type { Run } from "@stigmer/apis/ai/stigmer/agentic/run/v1/api_pb";
|
|
92
|
+
*
|
|
93
|
+
* function RunVersion({ run }: { run: Run }) {
|
|
94
|
+
* const { versions } = useAgentVersions("acme", "reviewer");
|
|
95
|
+
* return <span>{agentVersionLabel(versions, run.status?.agentVersionHash ?? "")}</span>; // "v2" or "3f2a9c1e0b7d"
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export function agentVersionLabel(versions, versionHash) {
|
|
100
|
+
const entry = versions.find((v) => v.id === versionHash);
|
|
101
|
+
return entry?.tag ?? versionHash.slice(0, SHORT_HASH_LENGTH);
|
|
102
|
+
}
|
|
103
|
+
function mapProtoToVersionEntry(proto) {
|
|
104
|
+
return {
|
|
105
|
+
id: proto.versionHash,
|
|
106
|
+
timestamp: proto.appliedAt ? timestampDate(proto.appliedAt) : new Date(0),
|
|
107
|
+
actor: proto.appliedBy
|
|
108
|
+
? {
|
|
109
|
+
id: proto.appliedBy.id,
|
|
110
|
+
avatar: proto.appliedBy.avatar || undefined,
|
|
111
|
+
displayName: undefined,
|
|
112
|
+
}
|
|
113
|
+
: undefined,
|
|
114
|
+
label: proto.versionHash.slice(0, SHORT_HASH_LENGTH),
|
|
115
|
+
sublabel: proto.message || undefined,
|
|
116
|
+
isCurrent: proto.isCurrent,
|
|
117
|
+
tag: proto.tag || undefined,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=useAgentVersions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgentVersions.js","sourceRoot":"","sources":["../src/agent/useAgentVersions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;A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CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC;IACzD,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,sBAAsB,CAAC,KAA6B;IAC3D,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,WAAW;QACrB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;QACzE,KAAK,EAAE,KAAK,CAAC,SAAS;YACpB,CAAC,CAAC;gBACE,EAAE,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE;gBACtB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,IAAI,SAAS;gBAC3C,WAAW,EAAE,SAAS;aACvB;YACH,CAAC,CAAC,SAAS;QACb,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC;QACpD,QAAQ,EAAE,KAAK,CAAC,OAAO,IAAI,SAAS;QACpC,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,SAAS;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { File as StigmerFile } from "@stigmer/apis/ai/stigmer/agentic/file/v1/api_pb";
|
|
2
|
+
import type { Run } from "@stigmer/apis/ai/stigmer/agentic/run/v1/api_pb";
|
|
3
|
+
/** Return value of {@link useSessionFiles}. */
|
|
4
|
+
export interface UseSessionFilesReturn {
|
|
5
|
+
/** Every File of the conversation, newest first. */
|
|
6
|
+
readonly files: readonly StigmerFile[];
|
|
7
|
+
/** The Files each turn returned, by run id, newest first. */
|
|
8
|
+
readonly outputsByRun: ReadonlyMap<string, readonly StigmerFile[]>;
|
|
9
|
+
/** True while the first read is in flight. */
|
|
10
|
+
readonly isLoading: boolean;
|
|
11
|
+
/** Error from the last failed read, or `null`. */
|
|
12
|
+
readonly error: Error | null;
|
|
13
|
+
/** Read the list again (a stopped turn's outputs arrive after its end). */
|
|
14
|
+
readonly refetch: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Data hook that lists a conversation's Files and groups each turn's
|
|
18
|
+
* outputs by run id.
|
|
19
|
+
*
|
|
20
|
+
* @param org - The conversation's organization, or `null` to skip.
|
|
21
|
+
* @param sessionId - The conversation's id, or `null` to skip.
|
|
22
|
+
* @param refreshKey - A string that changes when a turn starts or ends:
|
|
23
|
+
* {@link sessionFilesRefreshKey} of the conversation's runs. A change
|
|
24
|
+
* re-reads the list.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* function TurnsWithFiles({ org, sessionId }: { org: string; sessionId: string }) {
|
|
29
|
+
* const conversation = useSessionConversation(sessionId, org);
|
|
30
|
+
* // Re-read as each turn starts and ends, so the files it made appear.
|
|
31
|
+
* const { outputsByRun } = useSessionFiles(org, sessionId, sessionFilesRefreshKey(conversation.runs));
|
|
32
|
+
* return <p>{outputsByRun.size} turns made files</p>;
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function useSessionFiles(org: string | null, sessionId: string | null, refreshKey: string): UseSessionFilesReturn;
|
|
37
|
+
/**
|
|
38
|
+
* The `refreshKey` {@link useSessionFiles} re-reads on: each run's id with
|
|
39
|
+
* whether it has ended, so the key moves when a turn starts (the Files sent
|
|
40
|
+
* with its message join the conversation) and when it ends (its outputs
|
|
41
|
+
* register), and at no other time.
|
|
42
|
+
*
|
|
43
|
+
* @param runs - The conversation's runs (`useSessionConversation().runs`).
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* function FileCount({ org, sessionId }: { org: string; sessionId: string }) {
|
|
48
|
+
* const conversation = useSessionConversation(sessionId, org);
|
|
49
|
+
* const { files } = useSessionFiles(org, sessionId, sessionFilesRefreshKey(conversation.runs));
|
|
50
|
+
* return <p>{files.length} files</p>;
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function sessionFilesRefreshKey(runs: readonly Run[]): string;
|
|
55
|
+
//# sourceMappingURL=useSessionFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSessionFiles.d.ts","sourceRoot":"","sources":["../src/file/useSessionFiles.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gDAAgD,CAAC;AAQ1E,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,CAAC;IACnE,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,UAAU,EAAE,MAAM,GACjB,qBAAqB,CA2CvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG,MAAM,CAOnE"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* Data hook over a conversation's Files: one list per conversation, read
|
|
4
|
+
* through `stigmer.file.listAll({org, session_id})`, with the Files each turn
|
|
5
|
+
* returned grouped by run id.
|
|
6
|
+
*
|
|
7
|
+
* Trade-offs:
|
|
8
|
+
* - Files join a conversation at two moments, and nothing streams either:
|
|
9
|
+
* the Files sent with a message become the conversation's when its turn
|
|
10
|
+
* starts, and a turn's outputs register when it ends. So the list re-reads
|
|
11
|
+
* when the host says a turn started or ended (`refreshKey`, each run's id
|
|
12
|
+
* with whether it has ended). That key moves exactly when the host's runs
|
|
13
|
+
* refetch shows either, so Files follow the runs with no second trigger,
|
|
14
|
+
* no callback threaded through the send path, and no polling.
|
|
15
|
+
* - A re-read keeps the previous list on screen (stale-while-revalidate);
|
|
16
|
+
* only a different conversation resets it.
|
|
17
|
+
* - The server lists newest first, and both fields keep that order.
|
|
18
|
+
* - A person's uploads carry no run id and are listed in `files` but never
|
|
19
|
+
* in `outputsByRun`: the outputs of a turn are only what it saved.
|
|
20
|
+
* - The key's rule is one function, `sessionFilesRefreshKey`, which every
|
|
21
|
+
* caller passes its runs through, so a host cannot build a key that
|
|
22
|
+
* misses a turn's end (a run count does: it moves when a turn starts and
|
|
23
|
+
* not when it ends, so that turn's outputs never appear).
|
|
24
|
+
*/
|
|
25
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
26
|
+
import { RunPhase } from "@stigmer/apis/ai/stigmer/agentic/run/v1/enum_pb";
|
|
27
|
+
import { isTerminalPhase } from "../run/run-phases.js";
|
|
28
|
+
import { useStigmer } from "../hooks.js";
|
|
29
|
+
import { useFetch } from "../internal/useFetch.js";
|
|
30
|
+
const NO_FILES = [];
|
|
31
|
+
/**
|
|
32
|
+
* Data hook that lists a conversation's Files and groups each turn's
|
|
33
|
+
* outputs by run id.
|
|
34
|
+
*
|
|
35
|
+
* @param org - The conversation's organization, or `null` to skip.
|
|
36
|
+
* @param sessionId - The conversation's id, or `null` to skip.
|
|
37
|
+
* @param refreshKey - A string that changes when a turn starts or ends:
|
|
38
|
+
* {@link sessionFilesRefreshKey} of the conversation's runs. A change
|
|
39
|
+
* re-reads the list.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* function TurnsWithFiles({ org, sessionId }: { org: string; sessionId: string }) {
|
|
44
|
+
* const conversation = useSessionConversation(sessionId, org);
|
|
45
|
+
* // Re-read as each turn starts and ends, so the files it made appear.
|
|
46
|
+
* const { outputsByRun } = useSessionFiles(org, sessionId, sessionFilesRefreshKey(conversation.runs));
|
|
47
|
+
* return <p>{outputsByRun.size} turns made files</p>;
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function useSessionFiles(org, sessionId, refreshKey) {
|
|
52
|
+
const stigmer = useStigmer();
|
|
53
|
+
const active = !!org && !!sessionId;
|
|
54
|
+
const { data, isLoading, error, refetch } = useFetch(org && sessionId
|
|
55
|
+
? async () => {
|
|
56
|
+
const files = [];
|
|
57
|
+
for await (const file of stigmer.file.listAll({ org, sessionId })) {
|
|
58
|
+
files.push(file);
|
|
59
|
+
}
|
|
60
|
+
return files;
|
|
61
|
+
}
|
|
62
|
+
: null, [org, sessionId, active, stigmer], NO_FILES, { cacheKey: active ? `session-files:${sessionId}` : undefined });
|
|
63
|
+
// A changed key re-reads in place; the first render's key is the mount's
|
|
64
|
+
// own read, so it never doubles it.
|
|
65
|
+
const lastKey = useRef(refreshKey);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (lastKey.current === refreshKey)
|
|
68
|
+
return;
|
|
69
|
+
lastKey.current = refreshKey;
|
|
70
|
+
refetch();
|
|
71
|
+
}, [refreshKey, refetch]);
|
|
72
|
+
const outputsByRun = useMemo(() => {
|
|
73
|
+
const byRun = new Map();
|
|
74
|
+
for (const file of data) {
|
|
75
|
+
const runId = file.status?.runId;
|
|
76
|
+
if (!runId)
|
|
77
|
+
continue;
|
|
78
|
+
const list = byRun.get(runId);
|
|
79
|
+
if (list)
|
|
80
|
+
list.push(file);
|
|
81
|
+
else
|
|
82
|
+
byRun.set(runId, [file]);
|
|
83
|
+
}
|
|
84
|
+
return byRun;
|
|
85
|
+
}, [data]);
|
|
86
|
+
return useMemo(() => ({ files: data, outputsByRun, isLoading, error, refetch }), [data, outputsByRun, isLoading, error, refetch]);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The `refreshKey` {@link useSessionFiles} re-reads on: each run's id with
|
|
90
|
+
* whether it has ended, so the key moves when a turn starts (the Files sent
|
|
91
|
+
* with its message join the conversation) and when it ends (its outputs
|
|
92
|
+
* register), and at no other time.
|
|
93
|
+
*
|
|
94
|
+
* @param runs - The conversation's runs (`useSessionConversation().runs`).
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```tsx
|
|
98
|
+
* function FileCount({ org, sessionId }: { org: string; sessionId: string }) {
|
|
99
|
+
* const conversation = useSessionConversation(sessionId, org);
|
|
100
|
+
* const { files } = useSessionFiles(org, sessionId, sessionFilesRefreshKey(conversation.runs));
|
|
101
|
+
* return <p>{files.length} files</p>;
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export function sessionFilesRefreshKey(runs) {
|
|
106
|
+
return runs
|
|
107
|
+
.map((run) => {
|
|
108
|
+
const ended = isTerminalPhase(run.status?.phase ?? RunPhase.RUN_PHASE_UNSPECIFIED);
|
|
109
|
+
return `${run.metadata?.id ?? ""}:${ended ? "ended" : "started"}`;
|
|
110
|
+
})
|
|
111
|
+
.join(",");
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=useSessionFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSessionFiles.js","sourceRoot":"","sources":["../src/file/useSessionFiles.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,S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I,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACpE,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { useAgentSearch } from "./agent/useAgentSearch.js";
|
|
2
2
|
export type { UseAgentSearchOptions, UseAgentSearchReturn } from "./agent/useAgentSearch.js";
|
|
3
|
+
export { agentVersionLabel, useAgentVersions } from "./agent/useAgentVersions.js";
|
|
4
|
+
export type { UseAgentVersionsReturn } from "./agent/useAgentVersions.js";
|
|
3
5
|
export type { InteractionModeOption } from "./composer/interaction-mode.js";
|
|
4
6
|
export { StigmerContext } from "./context.js";
|
|
5
7
|
export { DeploymentModeContext, useDeploymentMode, useResourceAvailable } from "./deployment-mode.js";
|
|
8
|
+
export { sessionFilesRefreshKey, useSessionFiles } from "./file/useSessionFiles.js";
|
|
9
|
+
export type { UseSessionFilesReturn } from "./file/useSessionFiles.js";
|
|
6
10
|
export { useWhoAmI } from "./grant/useWhoAmI.js";
|
|
7
11
|
export type { UseWhoAmIOptions, UseWhoAmIReturn } from "./grant/useWhoAmI.js";
|
|
8
12
|
export { useStigmer } from "./hooks.js";
|
|
@@ -18,11 +22,14 @@ export { FileReviewContext, useFileReviewRowChange, useFileReviewRowState } from
|
|
|
18
22
|
export type { FileReviewContextValue } from "./run/FileReviewContext.js";
|
|
19
23
|
export { changeForRowPath, changeSetReviewability, fileChangeKindOf, fileForRowPath, fileReviewRowChange, fileReviewRowState, fileReviewability, } from "./run/file-review-status.js";
|
|
20
24
|
export type { ChangeSetReviewability, FileBlockReason, FileReviewRowState, FileReviewability, } from "./run/file-review-status.js";
|
|
25
|
+
export { deriveRunFileChanges } from "./run/deriveRunFileChanges.js";
|
|
21
26
|
export { runPhaseOf } from "./run/run-phases.js";
|
|
22
27
|
export { defaultDisclosureForCategory, extractPrimaryArg, extractShellIntentFromPreview, humanizeToolName, resolveToolCategory, resolveToolCategoryFromCall, resolveToolCategoryFromKind, subagentSubjectOf, toolKindToCategoryInfo, } from "./run/tool-categories.js";
|
|
23
28
|
export type { ToolDisclosure } from "./run/tool-categories.js";
|
|
24
29
|
export { useAnswerToolUse } from "./run/useAnswerToolUse.js";
|
|
25
30
|
export type { ToolUseAnswer, UseAnswerToolUseReturn } from "./run/useAnswerToolUse.js";
|
|
31
|
+
export { useAnswerCustomToolUse } from "./run/useAnswerCustomToolUse.js";
|
|
32
|
+
export type { CustomToolAnswerOptions, UseAnswerCustomToolUseReturn } from "./run/useAnswerCustomToolUse.js";
|
|
26
33
|
export { useArtifactContent } from "./run/useArtifactContent.js";
|
|
27
34
|
export type { UseArtifactContentReturn } from "./run/useArtifactContent.js";
|
|
28
35
|
export { useArtifactDownloadUrl } from "./run/useArtifactDownloadUrl.js";
|
|
@@ -50,8 +57,12 @@ export { useSessionConversation } from "./session/useSessionConversation.js";
|
|
|
50
57
|
export type { SendFollowUpOptions, UseSessionConversationReturn } from "./session/useSessionConversation.js";
|
|
51
58
|
export { useSessionEvents } from "./session/useSessionEvents.js";
|
|
52
59
|
export type { UseSessionEventsOptions, UseSessionEventsReturn } from "./session/useSessionEvents.js";
|
|
60
|
+
export { useSessionFileChanges } from "./session/useSessionFileChanges.js";
|
|
61
|
+
export type { UseSessionFileChangesReturn } from "./session/useSessionFileChanges.js";
|
|
53
62
|
export { useSessionList } from "./session/useSessionList.js";
|
|
54
63
|
export type { UseSessionListOptions, UseSessionListReturn } from "./session/useSessionList.js";
|
|
64
|
+
export { deriveSessionOutputs, outputKey, useSessionOutputs } from "./session/useSessionOutputs.js";
|
|
65
|
+
export type { SessionOutputEntry, UseSessionOutputsReturn } from "./session/useSessionOutputs.js";
|
|
55
66
|
export { useSessionRuns } from "./session/useSessionRuns.js";
|
|
56
67
|
export type { UseSessionRunsReturn } from "./session/useSessionRuns.js";
|
|
57
68
|
export { useSessionUsage } from "./session/useSessionUsage.js";
|
|
@@ -60,6 +71,7 @@ export { useUpdateSession } from "./session/useUpdateSession.js";
|
|
|
60
71
|
export type { UseUpdateSessionReturn } from "./session/useUpdateSession.js";
|
|
61
72
|
export { computeDiff } from "./version-history/computeDiff.js";
|
|
62
73
|
export type { DiffHunk, DiffLine } from "./version-history/diff-types.js";
|
|
74
|
+
export type { VersionEntry } from "./version-history/version-entry.js";
|
|
63
75
|
export type { BackoffOptions } from "./internal/backoff.js";
|
|
64
76
|
export type { ConversationStore, Listener as ConversationStoreListener, StreamState } from "./internal/store/conversation-store.js";
|
|
65
77
|
export type { SpeedTier } from "./models/registry.js";
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC7F,YAAY,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACxF,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,gBA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E,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/index.js
CHANGED
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
// - "@stigmer/react-core/internal": the React kit's own plumbing, with no
|
|
18
18
|
// compatibility promise (./internal.ts).
|
|
19
19
|
export { useAgentSearch } from "./agent/useAgentSearch.js";
|
|
20
|
+
export { agentVersionLabel, useAgentVersions } from "./agent/useAgentVersions.js";
|
|
20
21
|
export { StigmerContext } from "./context.js";
|
|
21
22
|
export { DeploymentModeContext, useDeploymentMode, useResourceAvailable } from "./deployment-mode.js";
|
|
23
|
+
export { sessionFilesRefreshKey, useSessionFiles } from "./file/useSessionFiles.js";
|
|
22
24
|
export { useWhoAmI } from "./grant/useWhoAmI.js";
|
|
23
25
|
export { useStigmer } from "./hooks.js";
|
|
24
26
|
export { FetchCacheProvider } from "./internal/FetchCacheProvider.js";
|
|
@@ -27,9 +29,11 @@ export { DEFAULT_MODEL_ID, DISABLED_PROVIDERS, fetchModelRegistry, fetchModelReg
|
|
|
27
29
|
export { thinkingLocked, thinkingSelectable } from "./models/thinking-mode.js";
|
|
28
30
|
export { FileReviewContext, useFileReviewRowChange, useFileReviewRowState } from "./run/FileReviewContext.js";
|
|
29
31
|
export { changeForRowPath, changeSetReviewability, fileChangeKindOf, fileForRowPath, fileReviewRowChange, fileReviewRowState, fileReviewability, } from "./run/file-review-status.js";
|
|
32
|
+
export { deriveRunFileChanges } from "./run/deriveRunFileChanges.js";
|
|
30
33
|
export { runPhaseOf } from "./run/run-phases.js";
|
|
31
34
|
export { defaultDisclosureForCategory, extractPrimaryArg, extractShellIntentFromPreview, humanizeToolName, resolveToolCategory, resolveToolCategoryFromCall, resolveToolCategoryFromKind, subagentSubjectOf, toolKindToCategoryInfo, } from "./run/tool-categories.js";
|
|
32
35
|
export { useAnswerToolUse } from "./run/useAnswerToolUse.js";
|
|
36
|
+
export { useAnswerCustomToolUse } from "./run/useAnswerCustomToolUse.js";
|
|
33
37
|
export { useArtifactContent } from "./run/useArtifactContent.js";
|
|
34
38
|
export { useArtifactDownloadUrl } from "./run/useArtifactDownloadUrl.js";
|
|
35
39
|
export { useCreateRun } from "./run/useCreateRun.js";
|
|
@@ -42,7 +46,9 @@ export { createLibraryListFn } from "./search/librarySource.js";
|
|
|
42
46
|
export { useSession } from "./session/useSession.js";
|
|
43
47
|
export { useSessionConversation } from "./session/useSessionConversation.js";
|
|
44
48
|
export { useSessionEvents } from "./session/useSessionEvents.js";
|
|
49
|
+
export { useSessionFileChanges } from "./session/useSessionFileChanges.js";
|
|
45
50
|
export { useSessionList } from "./session/useSessionList.js";
|
|
51
|
+
export { deriveSessionOutputs, outputKey, useSessionOutputs } from "./session/useSessionOutputs.js";
|
|
46
52
|
export { useSessionRuns } from "./session/useSessionRuns.js";
|
|
47
53
|
export { useSessionUsage } from "./session/useSessionUsage.js";
|
|
48
54
|
export { useUpdateSession } from "./session/useUpdateSession.js";
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,0EAA0E;AAC1E,yEAAyE;AACzE,iCAAiC;AACjC,EAAE;AACF,0DAA0D;AAC1D,uEAAuE;AACvE,yEAAyE;AACzE,6DAA6D;AAC7D,EAAE;AACF,WAAW;AACX,4DAA4D;AAC5D,uEAAuE;AACvE,4EAA4E;AAC5E,6CAA6C;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,0EAA0E;AAC1E,yEAAyE;AACzE,iCAAiC;AACjC,E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AO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/react-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React hooks for Stigmer, the open-source backend for the agents in your product: the conversation layer, with no rendering package",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@bufbuild/protobuf": "^2.8.0",
|
|
43
|
-
"@stigmer/apis": "0.
|
|
44
|
-
"@stigmer/client": "0.
|
|
43
|
+
"@stigmer/apis": "0.4.0",
|
|
44
|
+
"@stigmer/client": "0.4.0",
|
|
45
45
|
"react": "^19.0.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Run } from "@stigmer/apis/ai/stigmer/agentic/run/v1/api_pb";
|
|
2
|
+
import { type DisplayFileChange } from "@stigmer/client";
|
|
3
|
+
/**
|
|
4
|
+
* Collapses the file changes captured across `executions` into one *net*
|
|
5
|
+
* {@link DisplayFileChange} per path, ordered for a file list (modified, then
|
|
6
|
+
* added/renamed, then deleted; alphabetical within each group).
|
|
7
|
+
*
|
|
8
|
+
* **Source.** Each run's file record ({@link displayFileChangeSets}: the
|
|
9
|
+
* change sets it captured, `RunStatus.file_changes`), each captured change
|
|
10
|
+
* projected via {@link toDisplayFileChange}. A run's record already includes
|
|
11
|
+
* subagent captures, so one pass per run suffices. What was decided about a
|
|
12
|
+
* file is the session's events, not this list.
|
|
13
|
+
*
|
|
14
|
+
* **Net-diff (not latest-wins).** A change is a *delta*: an agent often
|
|
15
|
+
* rewrites the same file several times, and showing only the last edit's diff
|
|
16
|
+
* would misrepresent what changed. So changes to the same path are reduced to
|
|
17
|
+
* a single net change: `before` from the first change, `after` from the last.
|
|
18
|
+
* Every capture is a complete file snapshot, so `first.before -> last.after`
|
|
19
|
+
* is exactly the net change. A group with one change (the common case) is
|
|
20
|
+
* passed through untouched.
|
|
21
|
+
*
|
|
22
|
+
* **Ordering is a correctness input.** `executions` MUST be chronological:
|
|
23
|
+
* the net collapse anchors on each path's first and last change, so two
|
|
24
|
+
* runs touching the same path (a session's follow-up turns) produce a
|
|
25
|
+
* wrong net diff if visited out of order.
|
|
26
|
+
*
|
|
27
|
+
* Counts for captures stay derivable by the presentation layer, matching
|
|
28
|
+
* the contract the SDK `tool-view` established.
|
|
29
|
+
*/
|
|
30
|
+
export declare function deriveRunFileChanges(executions: readonly Run[]): readonly DisplayFileChange[];
|
|
31
|
+
//# sourceMappingURL=deriveRunFileChanges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deriveRunFileChanges.d.ts","sourceRoot":"","sources":["../src/run/deriveRunFileChanges.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,GAAG,EAAE,GACzB,SAAS,iBAAiB,EAAE,CAqB9B"}
|