@parall/parall 1.30.0 → 1.32.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/dist/accounts.d.ts +1 -1
- package/dist/accounts.js +4 -4
- package/dist/channel.d.ts +2 -2
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +10 -10
- package/dist/config-manager.d.ts +1 -1
- package/dist/config-manager.d.ts.map +1 -1
- package/dist/config-manager.js +70 -30
- package/dist/fork.d.ts.map +1 -1
- package/dist/fork.js +17 -17
- package/dist/gateway.d.ts +3 -3
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +214 -171
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +52 -26
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/oc-session.d.ts.map +1 -1
- package/dist/oc-session.js +35 -27
- package/dist/outbound.d.ts +2 -2
- package/dist/outbound.d.ts.map +1 -1
- package/dist/outbound.js +13 -14
- package/dist/routing.d.ts +2 -2
- package/dist/routing.js +1 -1
- package/dist/runtime.d.ts +5 -5
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +2 -2
- package/dist/session.js +4 -4
- package/dist/wiki-helper.d.ts.map +1 -1
- package/dist/wiki-helper.js +27 -27
- package/openclaw.plugin.json +4 -1
- package/package.json +3 -3
- package/skills/parall-clips/SKILL.md +48 -0
- package/src/accounts.ts +5 -5
- package/src/channel.ts +15 -14
- package/src/config-manager.ts +79 -34
- package/src/fork.ts +26 -22
- package/src/gateway.ts +245 -175
- package/src/hooks.ts +109 -50
- package/src/index.ts +8 -8
- package/src/oc-session.ts +43 -35
- package/src/outbound.ts +18 -17
- package/src/routing.ts +2 -2
- package/src/runtime.ts +11 -7
- package/src/session.ts +4 -4
- package/src/wiki-helper.ts +47 -34
package/dist/accounts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResolvedParallAccount } from
|
|
1
|
+
import type { ResolvedParallAccount } from './types.js';
|
|
2
2
|
type OpenClawConfig = Record<string, unknown>;
|
|
3
3
|
export declare function listParallAccountIds(cfg: OpenClawConfig): string[];
|
|
4
4
|
export declare function resolveParallAccount(params: {
|
package/dist/accounts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const DEFAULT_ACCOUNT_ID =
|
|
1
|
+
const DEFAULT_ACCOUNT_ID = 'default';
|
|
2
2
|
function readParallConfig(cfg) {
|
|
3
3
|
const channels = cfg.channels;
|
|
4
4
|
return channels?.parall;
|
|
@@ -13,9 +13,9 @@ export function resolveParallAccount(params) {
|
|
|
13
13
|
const { cfg, accountId = DEFAULT_ACCOUNT_ID } = params;
|
|
14
14
|
const parallCfg = readParallConfig(cfg);
|
|
15
15
|
const config = {
|
|
16
|
-
parall_url: parallCfg?.parall_url ??
|
|
17
|
-
api_key: parallCfg?.api_key ??
|
|
18
|
-
org_id: parallCfg?.org_id ??
|
|
16
|
+
parall_url: parallCfg?.parall_url ?? '',
|
|
17
|
+
api_key: parallCfg?.api_key ?? '',
|
|
18
|
+
org_id: parallCfg?.org_id ?? '',
|
|
19
19
|
ws_url: parallCfg?.ws_url,
|
|
20
20
|
enabled: parallCfg?.enabled,
|
|
21
21
|
};
|
package/dist/channel.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChannelPlugin } from
|
|
2
|
-
import type { ResolvedParallAccount } from
|
|
1
|
+
import type { ChannelPlugin } from 'openclaw/plugin-sdk/core';
|
|
2
|
+
import type { ResolvedParallAccount } from './types.js';
|
|
3
3
|
export declare const parallPlugin: ChannelPlugin<ResolvedParallAccount>;
|
|
4
4
|
//# sourceMappingURL=channel.d.ts.map
|
package/dist/channel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAWxD,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAWxD,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,qBAAqB,CAyB7D,CAAC"}
|
package/dist/channel.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { listParallAccountIds, resolveParallAccount } from
|
|
2
|
-
import { parallGateway } from
|
|
3
|
-
import { parallOutbound } from
|
|
1
|
+
import { listParallAccountIds, resolveParallAccount } from './accounts.js';
|
|
2
|
+
import { parallGateway } from './gateway.js';
|
|
3
|
+
import { parallOutbound } from './outbound.js';
|
|
4
4
|
const meta = {
|
|
5
|
-
id:
|
|
6
|
-
label:
|
|
7
|
-
selectionLabel:
|
|
8
|
-
docsPath:
|
|
9
|
-
blurb:
|
|
5
|
+
id: 'parall',
|
|
6
|
+
label: 'Parall',
|
|
7
|
+
selectionLabel: 'Parall IM',
|
|
8
|
+
docsPath: '/channels/parall',
|
|
9
|
+
blurb: 'Agent-Native IM platform.',
|
|
10
10
|
order: 80,
|
|
11
11
|
};
|
|
12
12
|
export const parallPlugin = {
|
|
13
|
-
id:
|
|
13
|
+
id: 'parall',
|
|
14
14
|
meta,
|
|
15
15
|
capabilities: {
|
|
16
|
-
chatTypes: [
|
|
16
|
+
chatTypes: ['direct', 'group'],
|
|
17
17
|
polls: false,
|
|
18
18
|
threads: false,
|
|
19
19
|
media: true,
|
package/dist/config-manager.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../src/config-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAWhD,UAAU,iBAAiB;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAClG;
|
|
1
|
+
{"version":3,"file":"config-manager.d.ts","sourceRoot":"","sources":["../src/config-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAWhD,UAAU,iBAAiB;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAClG;AAwKD;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDxF"}
|
package/dist/config-manager.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as fs from
|
|
2
|
-
import * as path from
|
|
3
|
-
const CACHE_FILENAME =
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
const CACHE_FILENAME = 'parall-platform-config.json';
|
|
4
4
|
/** Tool names are no longer registered — all operations go through CLI. */
|
|
5
5
|
function cachePath(stateDir) {
|
|
6
6
|
return path.join(stateDir, CACHE_FILENAME);
|
|
7
7
|
}
|
|
8
8
|
function loadCachedConfig(stateDir) {
|
|
9
9
|
try {
|
|
10
|
-
const raw = fs.readFileSync(cachePath(stateDir),
|
|
10
|
+
const raw = fs.readFileSync(cachePath(stateDir), 'utf-8');
|
|
11
11
|
return JSON.parse(raw);
|
|
12
12
|
}
|
|
13
13
|
catch {
|
|
@@ -23,55 +23,80 @@ function saveCachedConfig(stateDir, config) {
|
|
|
23
23
|
const filePath = cachePath(stateDir);
|
|
24
24
|
const tmpPath = `${filePath}.tmp`;
|
|
25
25
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
26
|
-
fs.writeFileSync(tmpPath, JSON.stringify(cached, null, 2),
|
|
26
|
+
fs.writeFileSync(tmpPath, JSON.stringify(cached, null, 2), 'utf-8');
|
|
27
27
|
fs.renameSync(tmpPath, filePath);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Deep-merge platform config into an existing openclaw.json file.
|
|
31
|
-
* Only overwrites `models.providers.parall
|
|
31
|
+
* Only overwrites `models.providers.parall`, `models.providers["parall-anthropic"]`,
|
|
32
|
+
* and `agents.defaults` sections;
|
|
32
33
|
* all other keys (user customizations, other providers) are preserved.
|
|
33
34
|
*/
|
|
34
35
|
function applyToOpenClawConfig(configPath, platformConfig, credentials) {
|
|
35
36
|
let existing = {};
|
|
36
37
|
try {
|
|
37
|
-
const raw = fs.readFileSync(configPath,
|
|
38
|
+
const raw = fs.readFileSync(configPath, 'utf-8');
|
|
38
39
|
existing = JSON.parse(raw);
|
|
39
40
|
}
|
|
40
41
|
catch {
|
|
41
42
|
// File doesn't exist or is invalid — start fresh
|
|
42
43
|
}
|
|
43
|
-
// Deep-merge models.providers
|
|
44
|
+
// Deep-merge models.providers for all Parall-managed providers
|
|
45
|
+
// (preserve existing fields, overlay platform, inject credentials).
|
|
44
46
|
const models = (existing.models ?? {});
|
|
45
47
|
const providers = (models.providers ?? {});
|
|
46
|
-
const existingParall = (providers.parall ?? {});
|
|
47
48
|
const platformModels = (platformConfig.models ?? {});
|
|
48
49
|
const platformProviders = (platformModels.providers ?? {});
|
|
49
|
-
const platformParall = (platformProviders.parall ?? {});
|
|
50
50
|
// Only forward keys OpenClaw's model schema recognizes — its strict Zod
|
|
51
51
|
// validation rejects unrecognized keys and skips the entire config reload.
|
|
52
|
-
const OPENCLAW_MODEL_KEYS = new Set([
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
const OPENCLAW_MODEL_KEYS = new Set(['id', 'name', 'contextWindow', 'maxTokens']);
|
|
53
|
+
// Parall-managed providers: overlay when present in the platform payload.
|
|
54
|
+
// parall-anthropic is deleted when absent (rollback safety — stale provider
|
|
55
|
+
// would route to anthropic-messages transport that older servers can't auth).
|
|
56
|
+
// parall is never deleted — it's the core provider; a malformed/empty
|
|
57
|
+
// response should not wipe out the agent's only LLM access.
|
|
58
|
+
const PARALL_MANAGED_PROVIDERS = ['parall', 'parall-anthropic'];
|
|
59
|
+
for (const providerName of PARALL_MANAGED_PROVIDERS) {
|
|
60
|
+
const rawProvider = platformProviders[providerName];
|
|
61
|
+
const platformProvider = rawProvider && typeof rawProvider === 'object' && !Array.isArray(rawProvider)
|
|
62
|
+
? rawProvider
|
|
63
|
+
: null;
|
|
64
|
+
if (!platformProvider) {
|
|
65
|
+
if (providerName !== 'parall')
|
|
66
|
+
delete providers[providerName];
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (Array.isArray(platformProvider.models)) {
|
|
70
|
+
platformProvider.models = platformProvider.models.map((m) => {
|
|
71
|
+
const cleaned = {};
|
|
72
|
+
for (const [k, v] of Object.entries(m)) {
|
|
73
|
+
if (OPENCLAW_MODEL_KEYS.has(k)) {
|
|
74
|
+
cleaned[k] = v;
|
|
75
|
+
}
|
|
59
76
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
77
|
+
return cleaned;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
providers[providerName] = {
|
|
81
|
+
...(providers[providerName] ?? {}),
|
|
82
|
+
...platformProvider,
|
|
83
|
+
apiKey: credentials.api_key,
|
|
84
|
+
};
|
|
63
85
|
}
|
|
64
|
-
providers.parall = {
|
|
65
|
-
...existingParall,
|
|
66
|
-
...platformParall,
|
|
67
|
-
apiKey: credentials.api_key,
|
|
68
|
-
};
|
|
69
86
|
models.providers = providers;
|
|
70
87
|
existing.models = models;
|
|
71
88
|
// Strip keys OpenClaw doesn't recognize from agents.defaults — platform-only
|
|
72
89
|
// keys like thinking_effort are consumed by agent-core's PlatformConfigManager.
|
|
73
90
|
// See: OpenClaw agents.defaults config schema.
|
|
74
|
-
const OPENCLAW_AGENTS_DEFAULTS_KEYS = new Set([
|
|
91
|
+
const OPENCLAW_AGENTS_DEFAULTS_KEYS = new Set(['model', 'compaction', 'memorySearch']);
|
|
92
|
+
// `model` is platform-sourced (delivered only on the catalog-gated Parall
|
|
93
|
+
// route) — it must NOT be carried over from the existing file, otherwise a
|
|
94
|
+
// stale `parall/...` model survives a switch to runtime_auth (the server then
|
|
95
|
+
// omits agents.defaults entirely) and the runtime keeps using the Parall
|
|
96
|
+
// provider. compaction / memorySearch are operator-tunable, so preserve those
|
|
97
|
+
// across applies; model is re-sourced from the platform overlay below or
|
|
98
|
+
// dropped when the platform sends none.
|
|
99
|
+
const OPENCLAW_PRESERVE_KEYS = new Set(['compaction', 'memorySearch']);
|
|
75
100
|
// Unconditionally sanitize existing defaults to self-heal already-poisoned
|
|
76
101
|
// openclaw.json files (e.g. mode=self agents that were poisoned while in
|
|
77
102
|
// platform mode).
|
|
@@ -79,7 +104,7 @@ function applyToOpenClawConfig(configPath, platformConfig, credentials) {
|
|
|
79
104
|
const existingDefaults = (agents.defaults ?? {});
|
|
80
105
|
const cleanedExisting = {};
|
|
81
106
|
for (const [k, v] of Object.entries(existingDefaults)) {
|
|
82
|
-
if (
|
|
107
|
+
if (OPENCLAW_PRESERVE_KEYS.has(k)) {
|
|
83
108
|
cleanedExisting[k] = v;
|
|
84
109
|
}
|
|
85
110
|
}
|
|
@@ -88,7 +113,7 @@ function applyToOpenClawConfig(configPath, platformConfig, credentials) {
|
|
|
88
113
|
const rawDefaults = platformAgents.defaults;
|
|
89
114
|
if (rawDefaults !== undefined &&
|
|
90
115
|
rawDefaults !== null &&
|
|
91
|
-
typeof rawDefaults ===
|
|
116
|
+
typeof rawDefaults === 'object' &&
|
|
92
117
|
!Array.isArray(rawDefaults)) {
|
|
93
118
|
const raw = rawDefaults;
|
|
94
119
|
for (const [k, v] of Object.entries(raw)) {
|
|
@@ -97,13 +122,28 @@ function applyToOpenClawConfig(configPath, platformConfig, credentials) {
|
|
|
97
122
|
}
|
|
98
123
|
}
|
|
99
124
|
}
|
|
125
|
+
// Bidirectional model rewrite for parall-anthropic. Gate on the fresh
|
|
126
|
+
// platform payload so rollback self-heals without manual intervention.
|
|
127
|
+
if (typeof cleanedExisting.model === 'string') {
|
|
128
|
+
const model = cleanedExisting.model;
|
|
129
|
+
if (platformProviders['parall-anthropic']) {
|
|
130
|
+
const fwd = model.match(/^parall\/(anthropic\/.+)$/);
|
|
131
|
+
if (fwd)
|
|
132
|
+
cleanedExisting.model = `parall-anthropic/${fwd[1]}`;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const rev = model.match(/^parall-anthropic\/(anthropic\/.+)$/);
|
|
136
|
+
if (rev)
|
|
137
|
+
cleanedExisting.model = `parall/${rev[1]}`;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
100
140
|
agents.defaults = cleanedExisting;
|
|
101
141
|
existing.agents = agents;
|
|
102
142
|
// No plugin tools to allow — all operations go through CLI.
|
|
103
143
|
// Atomic write
|
|
104
144
|
const tmpPath = `${configPath}.tmp`;
|
|
105
145
|
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
106
|
-
fs.writeFileSync(tmpPath, JSON.stringify(existing, null, 2),
|
|
146
|
+
fs.writeFileSync(tmpPath, JSON.stringify(existing, null, 2), 'utf-8');
|
|
107
147
|
fs.renameSync(tmpPath, configPath);
|
|
108
148
|
}
|
|
109
149
|
/**
|
|
@@ -132,7 +172,7 @@ export async function fetchAndApplyPlatformConfig(opts) {
|
|
|
132
172
|
}
|
|
133
173
|
// 3. 304 — config unchanged
|
|
134
174
|
if (fresh === null) {
|
|
135
|
-
log?.info(
|
|
175
|
+
log?.info('platform config unchanged (304)');
|
|
136
176
|
if (cached) {
|
|
137
177
|
applyToOpenClawConfig(configPath, cached.config, credentials);
|
|
138
178
|
}
|
package/dist/fork.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../src/fork.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../src/fork.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAsDF,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAE/E;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAqB5F;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGvF;AAMD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,iBAAiB,GAAG,IAAI,CA4D3B;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CASP"}
|
package/dist/fork.js
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
// history up to (but not including) the in-flight dispatch. Without a
|
|
7
7
|
// branch point, the fork falls back to the current on-disk leaf — which
|
|
8
8
|
// may include partial in-flight state.
|
|
9
|
-
import * as fs from
|
|
10
|
-
import * as path from
|
|
11
|
-
import * as crypto from
|
|
12
|
-
import { CURRENT_SESSION_VERSION, SessionManager } from
|
|
9
|
+
import * as fs from 'node:fs';
|
|
10
|
+
import * as path from 'node:path';
|
|
11
|
+
import * as crypto from 'node:crypto';
|
|
12
|
+
import { CURRENT_SESSION_VERSION, SessionManager } from './oc-session.js';
|
|
13
13
|
function readStoreEntry(sessionsDir, sessionKey) {
|
|
14
|
-
const storeFile = path.join(sessionsDir,
|
|
14
|
+
const storeFile = path.join(sessionsDir, 'sessions.json');
|
|
15
15
|
try {
|
|
16
|
-
const store = JSON.parse(fs.readFileSync(storeFile,
|
|
16
|
+
const store = JSON.parse(fs.readFileSync(storeFile, 'utf-8'));
|
|
17
17
|
return store[sessionKey] ?? store[sessionKey.toLowerCase()] ?? null;
|
|
18
18
|
}
|
|
19
19
|
catch {
|
|
@@ -21,17 +21,17 @@ function readStoreEntry(sessionsDir, sessionKey) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
function writeStoreEntry(sessionsDir, sessionKey, entry) {
|
|
24
|
-
const storeFile = path.join(sessionsDir,
|
|
24
|
+
const storeFile = path.join(sessionsDir, 'sessions.json');
|
|
25
25
|
try {
|
|
26
26
|
let store = {};
|
|
27
27
|
try {
|
|
28
|
-
store = JSON.parse(fs.readFileSync(storeFile,
|
|
28
|
+
store = JSON.parse(fs.readFileSync(storeFile, 'utf-8'));
|
|
29
29
|
}
|
|
30
30
|
catch {
|
|
31
31
|
// Empty or missing — start fresh.
|
|
32
32
|
}
|
|
33
33
|
store[sessionKey.toLowerCase()] = entry;
|
|
34
|
-
fs.writeFileSync(storeFile, JSON.stringify(store, null, 2), { encoding:
|
|
34
|
+
fs.writeFileSync(storeFile, JSON.stringify(store, null, 2), { encoding: 'utf-8' });
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
37
|
catch {
|
|
@@ -39,12 +39,12 @@ function writeStoreEntry(sessionsDir, sessionKey, entry) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
function deleteStoreEntry(sessionsDir, sessionKey) {
|
|
42
|
-
const storeFile = path.join(sessionsDir,
|
|
42
|
+
const storeFile = path.join(sessionsDir, 'sessions.json');
|
|
43
43
|
try {
|
|
44
|
-
const store = JSON.parse(fs.readFileSync(storeFile,
|
|
44
|
+
const store = JSON.parse(fs.readFileSync(storeFile, 'utf-8'));
|
|
45
45
|
delete store[sessionKey];
|
|
46
46
|
delete store[sessionKey.toLowerCase()];
|
|
47
|
-
fs.writeFileSync(storeFile, JSON.stringify(store, null, 2), { encoding:
|
|
47
|
+
fs.writeFileSync(storeFile, JSON.stringify(store, null, 2), { encoding: 'utf-8' });
|
|
48
48
|
}
|
|
49
49
|
catch {
|
|
50
50
|
// Best-effort cleanup.
|
|
@@ -69,7 +69,7 @@ export function resolveTranscriptFile(sessionsDir, sessionKey) {
|
|
|
69
69
|
return conventional;
|
|
70
70
|
try {
|
|
71
71
|
const files = fs.readdirSync(sessionsDir);
|
|
72
|
-
const match = files.find((file) => file.includes(entry.sessionId) && file.endsWith(
|
|
72
|
+
const match = files.find((file) => file.includes(entry.sessionId) && file.endsWith('.jsonl'));
|
|
73
73
|
return match ? path.join(sessionsDir, match) : null;
|
|
74
74
|
}
|
|
75
75
|
catch {
|
|
@@ -116,10 +116,10 @@ export function forkOrchestratorSession(opts) {
|
|
|
116
116
|
// Fallback: no leaf node — create a header-only fork file manually.
|
|
117
117
|
sessionId = crypto.randomUUID();
|
|
118
118
|
const timestamp = new Date().toISOString();
|
|
119
|
-
const fileTimestamp = timestamp.replace(/[:.]/g,
|
|
119
|
+
const fileTimestamp = timestamp.replace(/[:.]/g, '-');
|
|
120
120
|
sessionFile = path.join(manager.getSessionDir(), `${fileTimestamp}_${sessionId}.jsonl`);
|
|
121
121
|
const header = {
|
|
122
|
-
type:
|
|
122
|
+
type: 'session',
|
|
123
123
|
version: CURRENT_SESSION_VERSION,
|
|
124
124
|
id: sessionId,
|
|
125
125
|
timestamp,
|
|
@@ -127,9 +127,9 @@ export function forkOrchestratorSession(opts) {
|
|
|
127
127
|
parentSession: transcriptFile,
|
|
128
128
|
};
|
|
129
129
|
fs.writeFileSync(sessionFile, `${JSON.stringify(header)}\n`, {
|
|
130
|
-
encoding:
|
|
130
|
+
encoding: 'utf-8',
|
|
131
131
|
mode: 0o600,
|
|
132
|
-
flag:
|
|
132
|
+
flag: 'wx',
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
const forkSessionKey = `${orchestratorSessionKey}:fork:${sessionId}`;
|
package/dist/gateway.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ChannelPlugin } from
|
|
1
|
+
import type { ChannelPlugin } from 'openclaw/plugin-sdk/core';
|
|
2
2
|
/** Extract ChannelGatewayAdapter from ChannelPlugin (removed from public SDK exports in 2026.3.24). */
|
|
3
|
-
type ChannelGatewayAdapter<T = unknown> = NonNullable<ChannelPlugin<T>[
|
|
4
|
-
import type { ResolvedParallAccount } from
|
|
3
|
+
type ChannelGatewayAdapter<T = unknown> = NonNullable<ChannelPlugin<T>['gateway']>;
|
|
4
|
+
import type { ResolvedParallAccount } from './types.js';
|
|
5
5
|
export declare const parallGateway: ChannelGatewayAdapter<ResolvedParallAccount>;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=gateway.d.ts.map
|
package/dist/gateway.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,uGAAuG;AACvG,KAAK,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,uGAAuG;AACvG,KAAK,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAgCnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA8SxD,eAAO,MAAM,aAAa,EAAE,qBAAqB,CAAC,qBAAqB,CAmJtE,CAAC"}
|