@shodocan/opencode-hindsight 1.0.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 +673 -0
- package/deploy/.env.example +22 -0
- package/deploy/README.md +56 -0
- package/deploy/docker-compose.yml +24 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +490 -0
- package/dist/config.d.ts +25 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15130 -0
- package/dist/services/client.d.ts +102 -0
- package/dist/services/client.d.ts.map +1 -0
- package/dist/services/compaction.d.ts +73 -0
- package/dist/services/compaction.d.ts.map +1 -0
- package/dist/services/context.d.ts +14 -0
- package/dist/services/context.d.ts.map +1 -0
- package/dist/services/jsonc.d.ts +7 -0
- package/dist/services/jsonc.d.ts.map +1 -0
- package/dist/services/logger.d.ts +2 -0
- package/dist/services/logger.d.ts.map +1 -0
- package/dist/services/privacy.d.ts +4 -0
- package/dist/services/privacy.d.ts.map +1 -0
- package/dist/services/tags.d.ts +86 -0
- package/dist/services/tags.d.ts.map +1 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ConversationMessage, MemoryType } from "../types/index.js";
|
|
2
|
+
export declare class HindsightClientWrapper {
|
|
3
|
+
private client;
|
|
4
|
+
private formatConversationMessage;
|
|
5
|
+
private formatConversationTranscript;
|
|
6
|
+
private getClient;
|
|
7
|
+
searchMemories(query: string, bank: string): Promise<{
|
|
8
|
+
results: Array<import("@vectorize-io/hindsight-client").RecallResult>;
|
|
9
|
+
trace?: {
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
} | null;
|
|
12
|
+
entities?: {
|
|
13
|
+
[key: string]: {
|
|
14
|
+
entity_id: string;
|
|
15
|
+
canonical_name: string;
|
|
16
|
+
observations: Array<{
|
|
17
|
+
text: string;
|
|
18
|
+
mentioned_at?: string | null;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
} | null;
|
|
22
|
+
chunks?: {
|
|
23
|
+
[key: string]: {
|
|
24
|
+
id: string;
|
|
25
|
+
text: string;
|
|
26
|
+
chunk_index: number;
|
|
27
|
+
truncated?: boolean;
|
|
28
|
+
};
|
|
29
|
+
} | null;
|
|
30
|
+
source_facts?: {
|
|
31
|
+
[key: string]: import("@vectorize-io/hindsight-client").RecallResult;
|
|
32
|
+
} | null;
|
|
33
|
+
success: true;
|
|
34
|
+
error?: undefined;
|
|
35
|
+
total?: undefined;
|
|
36
|
+
timing?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
success: false;
|
|
39
|
+
error: string;
|
|
40
|
+
results: never[];
|
|
41
|
+
total: number;
|
|
42
|
+
timing: number;
|
|
43
|
+
}>;
|
|
44
|
+
getProfile(bank: string, query?: string): Promise<{
|
|
45
|
+
success: true;
|
|
46
|
+
results: import("@vectorize-io/hindsight-client").RecallResult[];
|
|
47
|
+
error?: undefined;
|
|
48
|
+
} | {
|
|
49
|
+
success: false;
|
|
50
|
+
error: string;
|
|
51
|
+
results: never[];
|
|
52
|
+
}>;
|
|
53
|
+
addMemory(content: string, bank: string, metadata?: {
|
|
54
|
+
type?: MemoryType;
|
|
55
|
+
tool?: string;
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}, options?: {
|
|
58
|
+
async?: boolean;
|
|
59
|
+
documentId?: string;
|
|
60
|
+
tags?: string[];
|
|
61
|
+
entities?: Array<{
|
|
62
|
+
text: string;
|
|
63
|
+
type?: string;
|
|
64
|
+
}>;
|
|
65
|
+
updateMode?: 'replace' | 'append';
|
|
66
|
+
}): Promise<any>;
|
|
67
|
+
deleteMemory(bank: string, memoryId: string): Promise<{
|
|
68
|
+
success: false;
|
|
69
|
+
error: string;
|
|
70
|
+
} | {
|
|
71
|
+
success: true;
|
|
72
|
+
error?: undefined;
|
|
73
|
+
}>;
|
|
74
|
+
listMemories(bank: string, limit?: number): Promise<{
|
|
75
|
+
success: true;
|
|
76
|
+
documents: {
|
|
77
|
+
id: any;
|
|
78
|
+
text: any;
|
|
79
|
+
similarity: any;
|
|
80
|
+
metadata: any;
|
|
81
|
+
date: any;
|
|
82
|
+
}[];
|
|
83
|
+
error?: undefined;
|
|
84
|
+
} | {
|
|
85
|
+
success: false;
|
|
86
|
+
error: string;
|
|
87
|
+
documents: never[];
|
|
88
|
+
}>;
|
|
89
|
+
ingestConversation(conversationId: string, messages: ConversationMessage[], banks: string[], metadata?: Record<string, string | number | boolean>): Promise<{
|
|
90
|
+
success: false;
|
|
91
|
+
error: string;
|
|
92
|
+
} | {
|
|
93
|
+
storedMemoryIds: string[];
|
|
94
|
+
id: string;
|
|
95
|
+
conversationId: string;
|
|
96
|
+
status: string;
|
|
97
|
+
success: true;
|
|
98
|
+
error?: undefined;
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
export declare const hindsightClient: HindsightClientWrapper;
|
|
102
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EACX,MAAM,mBAAmB,CAAC;AAc3B,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAgC;IAE9C,OAAO,CAAC,yBAAyB;IAmBjC,OAAO,CAAC,4BAA4B;IAMpC,OAAO,CAAC,SAAS;IAaX,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmB1C,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;;;;;;;;;IAoBvC,SAAS,CACb,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,EACvE,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,QAAQ,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClD,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;KACnC;IAoEG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;IAmB3C,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,SAAK;;;;;;;;;;;;;;;IA6BrC,kBAAkB,CACtB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;;;;;;;;;;;CA4EvD;AAED,eAAO,MAAM,eAAe,wBAA+B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ResolvedBanks } from "./tags.js";
|
|
2
|
+
export type CompactionBankResolver = (input?: {
|
|
3
|
+
agent?: string | null;
|
|
4
|
+
}) => ResolvedBanks;
|
|
5
|
+
export interface CompactionOptions {
|
|
6
|
+
threshold?: number;
|
|
7
|
+
getModelLimit?: (providerID: string, modelID: string) => number | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface CompactionContext {
|
|
10
|
+
directory: string;
|
|
11
|
+
client: {
|
|
12
|
+
session: {
|
|
13
|
+
summarize: (params: {
|
|
14
|
+
path: {
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
body: {
|
|
18
|
+
providerID: string;
|
|
19
|
+
modelID: string;
|
|
20
|
+
};
|
|
21
|
+
query: {
|
|
22
|
+
directory: string;
|
|
23
|
+
};
|
|
24
|
+
}) => Promise<unknown>;
|
|
25
|
+
messages: (params: {
|
|
26
|
+
path: {
|
|
27
|
+
id: string;
|
|
28
|
+
};
|
|
29
|
+
query: {
|
|
30
|
+
directory: string;
|
|
31
|
+
};
|
|
32
|
+
}) => Promise<{
|
|
33
|
+
data?: Array<{
|
|
34
|
+
info: any;
|
|
35
|
+
}>;
|
|
36
|
+
}>;
|
|
37
|
+
promptAsync: (params: {
|
|
38
|
+
path: {
|
|
39
|
+
id: string;
|
|
40
|
+
};
|
|
41
|
+
body: {
|
|
42
|
+
agent?: string;
|
|
43
|
+
parts: Array<{
|
|
44
|
+
type: string;
|
|
45
|
+
text: string;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
query: {
|
|
49
|
+
directory: string;
|
|
50
|
+
};
|
|
51
|
+
}) => Promise<unknown>;
|
|
52
|
+
};
|
|
53
|
+
tui: {
|
|
54
|
+
showToast: (params: {
|
|
55
|
+
body: {
|
|
56
|
+
title: string;
|
|
57
|
+
message: string;
|
|
58
|
+
variant: string;
|
|
59
|
+
duration: number;
|
|
60
|
+
};
|
|
61
|
+
}) => Promise<unknown>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export declare function createCompactionHook(ctx: CompactionContext, resolveBanksForCompaction: CompactionBankResolver, options?: CompactionOptions): {
|
|
66
|
+
event({ event }: {
|
|
67
|
+
event: {
|
|
68
|
+
type: string;
|
|
69
|
+
properties?: unknown;
|
|
70
|
+
};
|
|
71
|
+
}): Promise<void>;
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=compaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../src/services/compaction.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAU/C,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,KAAK,aAAa,CAAC;AAE1F,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC7E;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE;QACN,OAAO,EAAE;YACP,SAAS,EAAE,CAAC,MAAM,EAAE;gBAAE,IAAI,EAAE;oBAAE,EAAE,EAAE,MAAM,CAAA;iBAAE,CAAC;gBAAC,IAAI,EAAE;oBAAE,UAAU,EAAE,MAAM,CAAC;oBAAC,OAAO,EAAE,MAAM,CAAA;iBAAE,CAAC;gBAAC,KAAK,EAAE;oBAAE,SAAS,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;YAC/I,QAAQ,EAAE,CAAC,MAAM,EAAE;gBAAE,IAAI,EAAE;oBAAE,EAAE,EAAE,MAAM,CAAA;iBAAE,CAAC;gBAAC,KAAK,EAAE;oBAAE,SAAS,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,KAAK,OAAO,CAAC;gBAAE,IAAI,CAAC,EAAE,KAAK,CAAC;oBAAE,IAAI,EAAE,GAAG,CAAA;iBAAE,CAAC,CAAA;aAAE,CAAC,CAAC;YACvH,WAAW,EAAE,CAAC,MAAM,EAAE;gBAAE,IAAI,EAAE;oBAAE,EAAE,EAAE,MAAM,CAAA;iBAAE,CAAC;gBAAC,IAAI,EAAE;oBAAE,KAAK,CAAC,EAAE,MAAM,CAAC;oBAAC,KAAK,EAAE,KAAK,CAAC;wBAAE,IAAI,EAAE,MAAM,CAAC;wBAAC,IAAI,EAAE,MAAM,CAAA;qBAAE,CAAC,CAAA;iBAAE,CAAC;gBAAC,KAAK,EAAE;oBAAE,SAAS,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;SAC3K,CAAC;QACF,GAAG,EAAE;YACH,SAAS,EAAE,CAAC,MAAM,EAAE;gBAAE,IAAI,EAAE;oBAAE,KAAK,EAAE,MAAM,CAAC;oBAAC,OAAO,EAAE,MAAM,CAAC;oBAAC,OAAO,EAAE,MAAM,CAAC;oBAAC,QAAQ,EAAE,MAAM,CAAA;iBAAE,CAAA;aAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;SAC1H,CAAC;KACH,CAAC;CACH;AAmDD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,iBAAiB,EACtB,yBAAyB,EAAE,sBAAsB,EACjD,OAAO,CAAC,EAAE,iBAAiB;qBA0EF;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,UAAU,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE;EAgG3E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface MemoryResult {
|
|
2
|
+
text?: string;
|
|
3
|
+
type?: string | null;
|
|
4
|
+
similarity?: number;
|
|
5
|
+
}
|
|
6
|
+
interface MemoriesResponse {
|
|
7
|
+
results?: MemoryResult[];
|
|
8
|
+
}
|
|
9
|
+
interface ProfileResponse {
|
|
10
|
+
results?: MemoryResult[];
|
|
11
|
+
}
|
|
12
|
+
export declare function formatContextForPrompt(profile: ProfileResponse | null, userMemories: MemoriesResponse, projectMemories: MemoriesResponse): string;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/services/context.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AAcD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,eAAe,GAAG,IAAI,EAC/B,YAAY,EAAE,gBAAgB,EAC9B,eAAe,EAAE,gBAAgB,GAChC,MAAM,CAoCR"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strips comments from JSONC content while respecting string boundaries.
|
|
3
|
+
* Handles // and /* comments, URLs in strings, and escaped quotes.
|
|
4
|
+
* Also removes trailing commas to support more relaxed JSONC format.
|
|
5
|
+
*/
|
|
6
|
+
export declare function stripJsoncComments(content: string): string;
|
|
7
|
+
//# sourceMappingURL=jsonc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc.d.ts","sourceRoot":"","sources":["../../src/services/jsonc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA+E1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAQA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,QAMlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy.d.ts","sourceRoot":"","sources":["../../src/services/privacy.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAGvD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export declare function getGitEmail(): string | null;
|
|
2
|
+
export declare function getUserBank(): string;
|
|
3
|
+
export declare function getProjectBank(directory: string): string;
|
|
4
|
+
export declare function getBanks(directory: string): {
|
|
5
|
+
user: string;
|
|
6
|
+
project: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Routing configuration shape: the bank maps and explicit project bank that
|
|
10
|
+
* drive resolution. Mirrors the relevant slice of {@link CONFIG}.
|
|
11
|
+
*/
|
|
12
|
+
export interface BankRoutingConfig {
|
|
13
|
+
/** Per-agent project bank overrides: exact names and glob patterns (`*` wildcard). */
|
|
14
|
+
agentProjectBanks?: Record<string, string>;
|
|
15
|
+
/** Runtime alias map: alias name -> concrete bank id. */
|
|
16
|
+
runtimeProjectBanks?: Record<string, string>;
|
|
17
|
+
/** Explicit project bank from config (acts as a fallback below agent matches). */
|
|
18
|
+
projectBank?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Input accepted by `resolveBanks`. All fields are explicit so the resolver
|
|
22
|
+
* is deterministic and side-effect free.
|
|
23
|
+
*/
|
|
24
|
+
export interface ResolveBanksInput {
|
|
25
|
+
/** Absolute project directory. Used for the generated fallback bank name. */
|
|
26
|
+
directory: string;
|
|
27
|
+
/** Agent name to match against `agentProjectBanks` patterns. */
|
|
28
|
+
agent?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Runtime project bank alias name (not a bank id). Resolved against
|
|
31
|
+
* `runtimeProjectBanks`. Throws when the alias is unknown. Runtime alias
|
|
32
|
+
* is supplied only through this field.
|
|
33
|
+
*/
|
|
34
|
+
projectBankAlias?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Options that control resolver behavior without changing input data.
|
|
38
|
+
* `config` and `env` allow deterministic tests without touching globals.
|
|
39
|
+
*/
|
|
40
|
+
export interface ResolveBanksOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Explicit routing config snapshot. When provided, its
|
|
43
|
+
* `agentProjectBanks`, `runtimeProjectBanks`, and `projectBank` are used
|
|
44
|
+
* instead of the global `CONFIG`. Omit to use the live `CONFIG`.
|
|
45
|
+
*/
|
|
46
|
+
config?: BankRoutingConfig;
|
|
47
|
+
/**
|
|
48
|
+
* Explicit env snapshot. When provided, `env.HINDSIGHT_PROJECT_BANK_ID`
|
|
49
|
+
* and `env.HINDSIGHT_BANK_ID` are used instead of `process.env`.
|
|
50
|
+
* Omit to read from `process.env`.
|
|
51
|
+
*/
|
|
52
|
+
env?: Record<string, string | undefined>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Identifies which source resolved the project bank. Values mirror the
|
|
56
|
+
* resolution precedence chain so routing logs are unambiguous.
|
|
57
|
+
*/
|
|
58
|
+
export type ProjectBankSource = "env:HINDSIGHT_PROJECT_BANK_ID" | "env:HINDSIGHT_BANK_ID" | "runtimeProjectBanks" | "agentProjectBanks" | "config:projectBank" | "generated";
|
|
59
|
+
/** Result of resolving banks for a single call. */
|
|
60
|
+
export interface ResolvedBanks {
|
|
61
|
+
user: string;
|
|
62
|
+
project: string;
|
|
63
|
+
/** Which source produced `project`. */
|
|
64
|
+
projectSource: ProjectBankSource;
|
|
65
|
+
/** Agent name that matched `agentProjectBanks` (exact or glob). */
|
|
66
|
+
agent?: string;
|
|
67
|
+
/** Runtime alias name resolved through `runtimeProjectBanks`. */
|
|
68
|
+
projectBankAlias?: string;
|
|
69
|
+
/** Pattern key in `agentProjectBanks` that matched `agent` (exact name or glob). */
|
|
70
|
+
agentPattern?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Pure per-call bank resolver implementing project bank precedence:
|
|
74
|
+
*
|
|
75
|
+
* 1. `HINDSIGHT_PROJECT_BANK_ID` env var
|
|
76
|
+
* 2. `HINDSIGHT_BANK_ID` env var (legacy fallback)
|
|
77
|
+
* 3. Runtime project bank alias (`projectBankAlias` resolved against
|
|
78
|
+
* `runtimeProjectBanks`)
|
|
79
|
+
* 4. Exact / glob `agentProjectBanks` match for `agent`
|
|
80
|
+
* 5. `projectBank` from config (explicit fallback)
|
|
81
|
+
* 6. Generated `p_<project>_<hash>` fallback
|
|
82
|
+
*
|
|
83
|
+
* The user bank is always resolved via {@link getUserBank}.
|
|
84
|
+
*/
|
|
85
|
+
export declare function resolveBanks(input: ResolveBanksInput, options?: ResolveBanksOptions): ResolvedBanks;
|
|
86
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/services/tags.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAO3C;AAED,wBAAgB,WAAW,IAAI,MAAM,CAapC;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CASxD;AAED,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAG7E;AAMD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,sFAAsF;IACtF,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,+BAA+B,GAC/B,uBAAuB,GACvB,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,GACpB,WAAW,CAAC;AAEhB,mDAAmD;AACnD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,aAAa,EAAE,iBAAiB,CAAC;IACjC,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAyDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,mBAAwB,GAChC,aAAa,CA2Ef"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type MemoryScope = "user" | "project";
|
|
2
|
+
export type MemoryType = "project-config" | "architecture" | "error-solution" | "preference" | "learned-pattern" | "conversation";
|
|
3
|
+
export type ConversationRole = "user" | "assistant" | "system" | "tool";
|
|
4
|
+
export type ConversationContentPart = {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: "image_url";
|
|
9
|
+
imageUrl: {
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export interface ConversationToolCall {
|
|
14
|
+
id: string;
|
|
15
|
+
type: "function";
|
|
16
|
+
function: {
|
|
17
|
+
name: string;
|
|
18
|
+
arguments: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface ConversationMessage {
|
|
22
|
+
role: ConversationRole;
|
|
23
|
+
content: string | ConversationContentPart[];
|
|
24
|
+
name?: string;
|
|
25
|
+
tool_calls?: ConversationToolCall[];
|
|
26
|
+
tool_call_id?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ConversationIngestResponse {
|
|
29
|
+
id: string;
|
|
30
|
+
conversationId: string;
|
|
31
|
+
status: string;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAE7C,MAAM,MAAM,UAAU,GAClB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,GACjB,cAAc,CAAC;AAEnB,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExE,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shodocan/opencode-hindsight",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "OpenCode plugin that gives coding agents persistent memory using Hindsight",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"opencode-hindsight": "dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/cli.ts --outfile ./dist/cli.js --target node && tsc --emitDeclarationOnly",
|
|
13
|
+
"dev": "tsc --watch",
|
|
14
|
+
"typecheck": "tsc --noEmit",
|
|
15
|
+
"test": "bun test",
|
|
16
|
+
"prepack": "bun run build"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"opencode",
|
|
20
|
+
"opencode-plugin",
|
|
21
|
+
"hindsight",
|
|
22
|
+
"hindsight-memory",
|
|
23
|
+
"persistent-memory",
|
|
24
|
+
"ai-agent",
|
|
25
|
+
"coding-agent",
|
|
26
|
+
"agent-memory",
|
|
27
|
+
"context-injection",
|
|
28
|
+
"vectorize"
|
|
29
|
+
],
|
|
30
|
+
"author": "Shodocan",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/Shodocan/opencode-hindsight.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/Shodocan/opencode-hindsight/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/Shodocan/opencode-hindsight#readme",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"registry": "https://registry.npmjs.org",
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@opencode-ai/plugin": "^1.0.162",
|
|
46
|
+
"@vectorize-io/hindsight-client": "0.6.2"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/bun": "latest",
|
|
50
|
+
"typescript": "^5.7.3"
|
|
51
|
+
},
|
|
52
|
+
"opencode": {
|
|
53
|
+
"type": "plugin",
|
|
54
|
+
"hooks": [
|
|
55
|
+
"chat.message",
|
|
56
|
+
"event"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist",
|
|
61
|
+
"deploy",
|
|
62
|
+
"README.md"
|
|
63
|
+
]
|
|
64
|
+
}
|