@tangleai/assistant 0.21.1 → 0.25.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/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @tangleai/assistant
2
2
 
3
+ ## 0.25.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @tangleai/agents@0.25.0
8
+ - @tangleai/context@0.25.0
9
+ - @tangleai/models@0.25.0
10
+
11
+ ## 0.24.1
12
+
13
+ ### Patch Changes
14
+
15
+ - @tangleai/agents@0.24.1
16
+ - @tangleai/context@0.24.1
17
+ - @tangleai/models@0.24.1
18
+
19
+ ## 0.24.0
20
+
21
+ ### Patch Changes
22
+
23
+ - @tangleai/agents@0.24.0
24
+ - @tangleai/context@0.24.0
25
+ - @tangleai/models@0.24.0
26
+
27
+ ## 0.23.0
28
+
29
+ ### Patch Changes
30
+
31
+ - @tangleai/agents@0.23.0
32
+ - @tangleai/context@0.23.0
33
+ - @tangleai/models@0.23.0
34
+
35
+ ## 0.22.0
36
+
37
+ ### Patch Changes
38
+
39
+ - Convert the migrated source, tests, benchmarks and hosts to strict TypeScript,
40
+ with JavaScript and declarations emitted through one release build. Move the
41
+ program pen from `@tangleai/jaren/program` and the Jaren integration barrel to
42
+ `@tangleai/linq/program`, preserving its JSON format and phantom binding types.
43
+ The new `@tangleai/linq` root exposes the program namespace and shared build error.
44
+
45
+ Match the embedder declarations to unknown widths before the first response,
46
+ retain precise ledger result variants, and enforce the refinement-pressure
47
+ instrument's stated 60-second deadline through the chat client's abort signal.
48
+ - Updated dependencies
49
+ - @tangleai/models@0.22.0
50
+ - @tangleai/context@0.22.0
51
+ - @tangleai/agents@0.22.0
52
+
3
53
  ## 0.21.1
4
54
 
5
55
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangleai/assistant",
3
- "version": "0.21.1",
3
+ "version": "0.25.0",
4
4
  "description": "Reusable assistant state, streaming lifecycle and optional Jaren visual component.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,13 +27,13 @@
27
27
  "**/*.css"
28
28
  ],
29
29
  "dependencies": {
30
- "@tangleai/models": "^0.21.1",
31
- "@tangleai/context": "^0.21.1",
32
- "@tangleai/agents": "^0.21.1",
33
- "@jarenjs/json": "0.84.3",
34
- "@jarenjs/app": "0.84.3",
35
- "@jarenjs/md": "0.84.3",
36
- "@jarenjs/mermaid": "0.84.3"
30
+ "@tangleai/models": "^0.25.0",
31
+ "@tangleai/context": "^0.25.0",
32
+ "@tangleai/agents": "^0.25.0",
33
+ "@jarenjs/json": "0.86.0",
34
+ "@jarenjs/app": "0.86.0",
35
+ "@jarenjs/md": "0.86.0",
36
+ "@jarenjs/mermaid": "0.86.0"
37
37
  },
38
38
  "private": false,
39
39
  "files": [
package/src/actions.d.ts CHANGED
@@ -1,11 +1,15 @@
1
1
  /** Assistant transitions received from the existing panel. */
2
- export const ASSISTANT_ACTIONS: {
2
+ export declare const ASSISTANT_ACTIONS: {
3
3
  'ai/cancel': {
4
- patch: {
4
+ patch: ({
5
5
  op: string;
6
6
  path: string;
7
7
  value: string;
8
- }[];
8
+ } | {
9
+ op: string;
10
+ path: string;
11
+ value: null;
12
+ })[];
9
13
  effects: {
10
14
  run: string;
11
15
  }[];
@@ -50,8 +54,8 @@ export const ASSISTANT_ACTIONS: {
50
54
  path: string;
51
55
  value: {
52
56
  status: string;
53
- detail: any;
54
- models: any[];
57
+ detail: null;
58
+ models: never[];
55
59
  };
56
60
  })[];
57
61
  };
@@ -61,8 +65,8 @@ export const ASSISTANT_ACTIONS: {
61
65
  path: string;
62
66
  value: {
63
67
  status: string;
64
- detail: any;
65
- models: any[];
68
+ detail: null;
69
+ models: never[];
66
70
  };
67
71
  }[];
68
72
  effects: {
@@ -110,6 +114,10 @@ export const ASSISTANT_ACTIONS: {
110
114
  op: string;
111
115
  path: string;
112
116
  value: string;
117
+ } | {
118
+ op: string;
119
+ path: string;
120
+ value: null;
113
121
  } | {
114
122
  op: string;
115
123
  path: string;
@@ -156,27 +164,39 @@ export const ASSISTANT_ACTIONS: {
156
164
  op: string;
157
165
  path: string;
158
166
  value: string;
167
+ } | {
168
+ op: string;
169
+ path: string;
170
+ value: null;
159
171
  })[];
160
172
  effects: {
161
173
  run: string;
162
174
  }[];
163
175
  };
164
176
  'ai/failed': {
165
- patch: {
177
+ patch: ({
166
178
  op: string;
167
179
  path: string;
168
180
  value: string;
169
- }[];
181
+ } | {
182
+ op: string;
183
+ path: string;
184
+ value: null;
185
+ })[];
170
186
  };
171
187
  'ai/clear': {
172
188
  patch: ({
173
189
  op: string;
174
190
  path: string;
175
- value: any[];
191
+ value: never[];
176
192
  } | {
177
193
  op: string;
178
194
  path: string;
179
195
  value: string;
196
+ } | {
197
+ op: string;
198
+ path: string;
199
+ value: null;
180
200
  })[];
181
201
  effects: {
182
202
  run: string;
@@ -214,11 +234,15 @@ export const ASSISTANT_ACTIONS: {
214
234
  }[];
215
235
  };
216
236
  'ai/remember': {
217
- patch: {
237
+ patch: ({
218
238
  op: string;
219
239
  path: string;
220
240
  value: boolean;
221
- }[];
241
+ } | {
242
+ op: string;
243
+ path: string;
244
+ value: null;
245
+ })[];
222
246
  effects: {
223
247
  run: string;
224
248
  }[];
package/src/actions.js CHANGED
@@ -1,145 +1,144 @@
1
- //@ts-check
2
1
  /** Assistant transitions received from the existing panel. */
3
2
  export const ASSISTANT_ACTIONS = {
4
- 'ai/cancel': {
5
- patch: [
6
- { op: 'replace', path: '/ai/status', value: 'idle' },
7
- { op: 'replace', path: '/ai/pending', value: '' },
8
- { op: 'replace', path: '/ai/activity', value: null },
9
- ],
10
- effects: [{ run: 'ai-cancel' }],
11
- },
12
- 'ai/toggle': {
13
- patch: [{ op: 'replace', path: '/ai/open', value: { $not: '$.ai.open' } }],
14
- // opening while unconfigured pins the settings form open (see
15
- // ai-ensure-settings), so it cannot vanish mid-edit as typing
16
- // makes the configuration valid. The ledger read is what makes a
17
- // reloaded page show the objective it was left with — the goal
18
- // lives in storage, not in this tab.
19
- effects: [{ run: 'ai-ensure-settings' }, { run: 'ai-ledger-read' }],
20
- },
21
- 'ai/settings-toggle': {
22
- patch: [{ op: 'replace', path: '/ai/settingsOpen', value: { $not: '$.ai.settingsOpen' } }],
23
- },
24
- 'ai/settings-open': {
25
- patch: [{ op: 'replace', path: '/ai/settingsOpen', value: '$payload' }],
26
- },
27
- 'ai/setting': {
28
- patch: [
29
- {
30
- op: 'add',
31
- path: { $concat: ['/ai/settings/', '$payload.key'] },
32
- value: '$event.value',
33
- },
34
- // an edited connection voids the last probe verdict
35
- { op: 'replace', path: '/ai/probe', value: { status: 'idle', detail: null, models: [] } },
36
- ],
37
- },
38
- 'ai/probe': {
39
- patch: [{
40
- op: 'replace',
41
- path: '/ai/probe',
42
- value: { status: 'busy', detail: null, models: [] },
43
- }],
44
- effects: [{ run: 'ai-probe' }],
45
- },
46
- 'ai/probe-result': {
47
- patch: [{ op: 'replace', path: '/ai/probe', value: '$payload' }],
48
- },
49
- 'ai/save-settings': {
50
- patch: [{ op: 'replace', path: '/ai/settingsOpen', value: false }],
51
- effects: [{ run: 'ai-save-settings' }],
52
- },
53
- 'ai/draft': {
54
- patch: [{ op: 'replace', path: '/ai/draft', value: '$event.value' }],
55
- },
56
- 'ai/send': { effects: [{ run: 'ai-send' }] },
57
- 'ai/user': {
58
- patch: [
59
- { op: 'add', path: '/ai/messages/-', value: { role: 'user', content: '$payload' } },
60
- { op: 'replace', path: '/ai/draft', value: '' },
61
- { op: 'replace', path: '/ai/pending', value: '' },
62
- { op: 'replace', path: '/ai/status', value: 'streaming' },
63
- { op: 'replace', path: '/ai/activity', value: null },
64
- { op: 'replace', path: '/ai/error', value: null },
65
- { op: 'replace', path: '/ai/reasoningChars', value: 0 },
66
- ],
67
- effects: [{ run: 'ai-persist' }],
68
- },
69
- 'ai/delta': {
70
- patch: [{ op: 'replace', path: '/ai/pending', value: { $concat: ['$.ai.pending', '$payload'] } }],
71
- },
72
- 'ai/reasoning': {
73
- patch: [{ op: 'replace', path: '/ai/reasoningChars', value: { $add: ['$.ai.reasoningChars', '$payload'] } }],
74
- },
75
- 'ai/activity': {
76
- patch: [{ op: 'replace', path: '/ai/activity', value: '$payload' }],
77
- },
78
- 'ai/reply': {
79
- patch: [
80
- { op: 'add', path: '/ai/messages/-', value: { role: 'assistant', content: '$payload' } },
81
- { op: 'replace', path: '/ai/pending', value: '' },
82
- { op: 'replace', path: '/ai/status', value: 'idle' },
83
- { op: 'replace', path: '/ai/activity', value: null },
84
- ],
85
- effects: [{ run: 'ai-persist' }],
86
- },
87
- 'ai/failed': {
88
- patch: [
89
- { op: 'replace', path: '/ai/status', value: 'error' },
90
- { op: 'replace', path: '/ai/error', value: '$payload' },
91
- { op: 'replace', path: '/ai/pending', value: '' },
92
- { op: 'replace', path: '/ai/activity', value: null },
93
- ],
94
- },
95
- 'ai/clear': {
96
- patch: [
97
- { op: 'replace', path: '/ai/messages', value: [] },
98
- { op: 'replace', path: '/ai/pending', value: '' },
99
- { op: 'replace', path: '/ai/status', value: 'idle' },
100
- { op: 'replace', path: '/ai/activity', value: null },
101
- { op: 'replace', path: '/ai/error', value: null },
102
- { op: 'replace', path: '/ai/remembered', value: null },
103
- ],
104
- // the archived rounds go with the transcript they were cut from:
105
- // their addresses only ever existed in its synopsis
106
- effects: [{ run: 'ai-clear-run' }, { run: 'ai-persist' }, { run: 'ai-clear-archive' }],
107
- },
108
- 'ai/ledger': {
109
- patch: [
110
- { op: 'replace', path: '/ai/goal', value: '$payload.goal' },
111
- { op: 'replace', path: '/ai/memories', value: '$payload.memories' },
112
- { op: 'replace', path: '/ai/archived', value: '$payload.archived' },
113
- { op: 'replace', path: '/ai/persistence', value: '$payload.persistence' },
114
- { op: 'replace', path: '/ai/retention', value: '$payload.retention' },
115
- ],
116
- },
117
- 'ai/goal-draft': {
118
- patch: [{ op: 'replace', path: '/ai/goalDraft', value: '$event.value' }],
119
- },
120
- 'ai/goal-set': { effects: [{ run: 'ai-goal-set' }] },
121
- 'ai/goal-committed': {
122
- patch: [
123
- { op: 'replace', path: '/ai/goal', value: '$payload.goal' },
124
- { op: 'replace', path: '/ai/memories', value: '$payload.memories' },
125
- { op: 'replace', path: '/ai/archived', value: '$payload.archived' },
126
- { op: 'replace', path: '/ai/persistence', value: '$payload.persistence' },
127
- { op: 'replace', path: '/ai/retention', value: '$payload.retention' },
128
- { op: 'replace', path: '/ai/goalDraft', value: '' },
129
- ],
130
- },
131
- 'ai/goal-clear': { effects: [{ run: 'ai-goal-clear' }] },
132
- 'ai/remember': {
133
- patch: [
134
- { op: 'replace', path: '/ai/remembering', value: true },
135
- { op: 'replace', path: '/ai/remembered', value: null },
136
- ],
137
- effects: [{ run: 'ai-remember' }],
138
- },
139
- 'ai/remembered': {
140
- patch: [
141
- { op: 'replace', path: '/ai/remembering', value: false },
142
- { op: 'replace', path: '/ai/remembered', value: '$payload.note' },
143
- ],
144
- },
3
+ 'ai/cancel': {
4
+ patch: [
5
+ { op: 'replace', path: '/ai/status', value: 'idle' },
6
+ { op: 'replace', path: '/ai/pending', value: '' },
7
+ { op: 'replace', path: '/ai/activity', value: null },
8
+ ],
9
+ effects: [{ run: 'ai-cancel' }],
10
+ },
11
+ 'ai/toggle': {
12
+ patch: [{ op: 'replace', path: '/ai/open', value: { $not: '$.ai.open' } }],
13
+ // opening while unconfigured pins the settings form open (see
14
+ // ai-ensure-settings), so it cannot vanish mid-edit as typing
15
+ // makes the configuration valid. The ledger read is what makes a
16
+ // reloaded page show the objective it was left with — the goal
17
+ // lives in storage, not in this tab.
18
+ effects: [{ run: 'ai-ensure-settings' }, { run: 'ai-ledger-read' }],
19
+ },
20
+ 'ai/settings-toggle': {
21
+ patch: [{ op: 'replace', path: '/ai/settingsOpen', value: { $not: '$.ai.settingsOpen' } }],
22
+ },
23
+ 'ai/settings-open': {
24
+ patch: [{ op: 'replace', path: '/ai/settingsOpen', value: '$payload' }],
25
+ },
26
+ 'ai/setting': {
27
+ patch: [
28
+ {
29
+ op: 'add',
30
+ path: { $concat: ['/ai/settings/', '$payload.key'] },
31
+ value: '$event.value',
32
+ },
33
+ // an edited connection voids the last probe verdict
34
+ { op: 'replace', path: '/ai/probe', value: { status: 'idle', detail: null, models: [] } },
35
+ ],
36
+ },
37
+ 'ai/probe': {
38
+ patch: [{
39
+ op: 'replace',
40
+ path: '/ai/probe',
41
+ value: { status: 'busy', detail: null, models: [] },
42
+ }],
43
+ effects: [{ run: 'ai-probe' }],
44
+ },
45
+ 'ai/probe-result': {
46
+ patch: [{ op: 'replace', path: '/ai/probe', value: '$payload' }],
47
+ },
48
+ 'ai/save-settings': {
49
+ patch: [{ op: 'replace', path: '/ai/settingsOpen', value: false }],
50
+ effects: [{ run: 'ai-save-settings' }],
51
+ },
52
+ 'ai/draft': {
53
+ patch: [{ op: 'replace', path: '/ai/draft', value: '$event.value' }],
54
+ },
55
+ 'ai/send': { effects: [{ run: 'ai-send' }] },
56
+ 'ai/user': {
57
+ patch: [
58
+ { op: 'add', path: '/ai/messages/-', value: { role: 'user', content: '$payload' } },
59
+ { op: 'replace', path: '/ai/draft', value: '' },
60
+ { op: 'replace', path: '/ai/pending', value: '' },
61
+ { op: 'replace', path: '/ai/status', value: 'streaming' },
62
+ { op: 'replace', path: '/ai/activity', value: null },
63
+ { op: 'replace', path: '/ai/error', value: null },
64
+ { op: 'replace', path: '/ai/reasoningChars', value: 0 },
65
+ ],
66
+ effects: [{ run: 'ai-persist' }],
67
+ },
68
+ 'ai/delta': {
69
+ patch: [{ op: 'replace', path: '/ai/pending', value: { $concat: ['$.ai.pending', '$payload'] } }],
70
+ },
71
+ 'ai/reasoning': {
72
+ patch: [{ op: 'replace', path: '/ai/reasoningChars', value: { $add: ['$.ai.reasoningChars', '$payload'] } }],
73
+ },
74
+ 'ai/activity': {
75
+ patch: [{ op: 'replace', path: '/ai/activity', value: '$payload' }],
76
+ },
77
+ 'ai/reply': {
78
+ patch: [
79
+ { op: 'add', path: '/ai/messages/-', value: { role: 'assistant', content: '$payload' } },
80
+ { op: 'replace', path: '/ai/pending', value: '' },
81
+ { op: 'replace', path: '/ai/status', value: 'idle' },
82
+ { op: 'replace', path: '/ai/activity', value: null },
83
+ ],
84
+ effects: [{ run: 'ai-persist' }],
85
+ },
86
+ 'ai/failed': {
87
+ patch: [
88
+ { op: 'replace', path: '/ai/status', value: 'error' },
89
+ { op: 'replace', path: '/ai/error', value: '$payload' },
90
+ { op: 'replace', path: '/ai/pending', value: '' },
91
+ { op: 'replace', path: '/ai/activity', value: null },
92
+ ],
93
+ },
94
+ 'ai/clear': {
95
+ patch: [
96
+ { op: 'replace', path: '/ai/messages', value: [] },
97
+ { op: 'replace', path: '/ai/pending', value: '' },
98
+ { op: 'replace', path: '/ai/status', value: 'idle' },
99
+ { op: 'replace', path: '/ai/activity', value: null },
100
+ { op: 'replace', path: '/ai/error', value: null },
101
+ { op: 'replace', path: '/ai/remembered', value: null },
102
+ ],
103
+ // the archived rounds go with the transcript they were cut from:
104
+ // their addresses only ever existed in its synopsis
105
+ effects: [{ run: 'ai-clear-run' }, { run: 'ai-persist' }, { run: 'ai-clear-archive' }],
106
+ },
107
+ 'ai/ledger': {
108
+ patch: [
109
+ { op: 'replace', path: '/ai/goal', value: '$payload.goal' },
110
+ { op: 'replace', path: '/ai/memories', value: '$payload.memories' },
111
+ { op: 'replace', path: '/ai/archived', value: '$payload.archived' },
112
+ { op: 'replace', path: '/ai/persistence', value: '$payload.persistence' },
113
+ { op: 'replace', path: '/ai/retention', value: '$payload.retention' },
114
+ ],
115
+ },
116
+ 'ai/goal-draft': {
117
+ patch: [{ op: 'replace', path: '/ai/goalDraft', value: '$event.value' }],
118
+ },
119
+ 'ai/goal-set': { effects: [{ run: 'ai-goal-set' }] },
120
+ 'ai/goal-committed': {
121
+ patch: [
122
+ { op: 'replace', path: '/ai/goal', value: '$payload.goal' },
123
+ { op: 'replace', path: '/ai/memories', value: '$payload.memories' },
124
+ { op: 'replace', path: '/ai/archived', value: '$payload.archived' },
125
+ { op: 'replace', path: '/ai/persistence', value: '$payload.persistence' },
126
+ { op: 'replace', path: '/ai/retention', value: '$payload.retention' },
127
+ { op: 'replace', path: '/ai/goalDraft', value: '' },
128
+ ],
129
+ },
130
+ 'ai/goal-clear': { effects: [{ run: 'ai-goal-clear' }] },
131
+ 'ai/remember': {
132
+ patch: [
133
+ { op: 'replace', path: '/ai/remembering', value: true },
134
+ { op: 'replace', path: '/ai/remembered', value: null },
135
+ ],
136
+ effects: [{ run: 'ai-remember' }],
137
+ },
138
+ 'ai/remembered': {
139
+ patch: [
140
+ { op: 'replace', path: '/ai/remembering', value: false },
141
+ { op: 'replace', path: '/ai/remembered', value: '$payload.note' },
142
+ ],
143
+ },
145
144
  };
@@ -1,5 +1,6 @@
1
- /** @param {HTMLElement | null} node @param {AssistantOptions} [options] */
2
- export function mountAssistant(node: HTMLElement | null, options?: AssistantOptions): {
1
+ import { createAssistantController } from './index.ts';
2
+ /** @param node @param [options] */
3
+ export declare function mountAssistant(node: HTMLElement | null, options?: AssistantOptions): {
3
4
  controller: {
4
5
  effects: {
5
6
  [k: string]: (props: any, dispatch: any) => void | Promise<any>;
@@ -10,13 +11,13 @@ export function mountAssistant(node: HTMLElement | null, options?: AssistantOpti
10
11
  };
11
12
  read: () => any;
12
13
  dispatch(action: any, payload?: any, event?: any): void;
13
- subscribe(listener: any): () => void;
14
+ subscribe(listener: any): any;
14
15
  /** Presentation updates retain the transcript, request and input node. */
15
16
  update(next: AssistantPresentation): void;
16
17
  dispose(): any;
17
18
  };
18
- /** @param {AssistantOptions} [options] */
19
- export function createAssistantWidget(options?: AssistantOptions): {
19
+ /** @param [options] */
20
+ export declare function createAssistantWidget(options?: AssistantOptions): {
20
21
  mount: (host: any, props: any) => {
21
22
  controller: {
22
23
  effects: {
@@ -28,7 +29,7 @@ export function createAssistantWidget(options?: AssistantOptions): {
28
29
  };
29
30
  read: () => any;
30
31
  dispatch(action: any, payload?: any, event?: any): void;
31
- subscribe(listener: any): () => void;
32
+ subscribe(listener: any): any;
32
33
  /** Presentation updates retain the transcript, request and input node. */
33
34
  update(next: AssistantPresentation): void;
34
35
  dispose(): any;
@@ -44,7 +45,7 @@ export type AssistantPresentation = {
44
45
  capabilities?: string[];
45
46
  settingsHint?: string;
46
47
  };
47
- export type AssistantOptions = AssistantPresentation & Partial<Omit<Parameters<typeof createAssistantController>[0], "getApp">> & {
48
+ export type AssistantOptions = AssistantPresentation & Partial<Omit<Parameters<typeof createAssistantController>[0], 'getApp'>> & {
48
49
  settings?: any;
49
50
  transcript?: any;
50
51
  open?: boolean;
@@ -52,4 +53,3 @@ export type AssistantOptions = AssistantPresentation & Partial<Omit<Parameters<t
52
53
  onError?: (error: Error) => void;
53
54
  renderMarkdown?: (source: string) => any;
54
55
  };
55
- import { createAssistantController } from './index.js';