@mininglamp-oss/octo-runtime 1.1.0 → 1.1.2
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 +4 -2
- package/apps/cli/README.md +3 -1
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/extras.d.ts +4 -2
- package/apps/cli/dist/extras.js +20 -21
- package/apps/cli/dist/help.js +3 -0
- package/apps/cli/dist/logs.d.ts +10 -0
- package/apps/cli/dist/logs.js +186 -0
- package/apps/cli/dist/main.d.ts +1 -0
- package/apps/cli/dist/main.js +94 -19
- package/apps/cli/dist/{default_adapters.json → manifest.json} +10 -0
- package/apps/cli/dist/module-manifest.d.ts +3 -0
- package/apps/cli/dist/module-manifest.js +11 -0
- package/apps/cli/dist/openclaw.js +30 -6
- package/apps/cli/dist/output.js +3 -0
- package/apps/cli/dist/playboard.js +10 -8
- package/apps/cli/dist/status-output.d.ts +10 -0
- package/apps/cli/dist/status-output.js +65 -0
- package/apps/cli/dist/worker.d.ts +1 -0
- package/apps/cli/dist/worker.js +18 -0
- package/dist/public/host.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +54 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +399 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.d.ts +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +156 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +29 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +273 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/interactions.d.ts +27 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/interactions.js +161 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +17 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.d.ts +24 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.js +181 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.js +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +229 -225
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +5 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.d.ts +33 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.js +118 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log-worker.js +7 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +45 -10
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.d.ts +11 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +70 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.d.ts +4 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +20 -21
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/logs.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/logs.js +186 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +94 -19
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/{default_adapters.json → manifest.json} +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +11 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/openclaw.js +30 -6
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +10 -8
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/status-output.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/status-output.js +65 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/worker.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/worker.js +18 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +23 -9
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.js +13 -9
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/heartbeat.d.ts +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/heartbeat.js +59 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/manifest-adapters.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/manifest-adapters.js +88 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/module-specifier.d.ts +1 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/module-specifier.js +2 -9
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.d.ts +7 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.js +138 -9
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runner.js +3 -92
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.js +36 -12
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +14 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.js +57 -34
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +8 -16
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +18 -18
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +24 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts +5 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js +19 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/config-schema.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/config-schema.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/index.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/store.d.ts +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/store.js +54 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.d.ts +8 -1
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +27 -12
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.js +39 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/node_modules/import-meta-resolve/index.d.ts +19 -0
- package/node_modules/import-meta-resolve/index.d.ts.map +1 -0
- package/node_modules/import-meta-resolve/index.js +47 -0
- package/node_modules/import-meta-resolve/lib/errors.d.ts +24 -0
- package/node_modules/import-meta-resolve/lib/errors.d.ts.map +1 -0
- package/node_modules/import-meta-resolve/lib/errors.js +504 -0
- package/node_modules/import-meta-resolve/lib/get-format.d.ts +13 -0
- package/node_modules/import-meta-resolve/lib/get-format.d.ts.map +1 -0
- package/node_modules/import-meta-resolve/lib/get-format.js +159 -0
- package/node_modules/import-meta-resolve/lib/package-json-reader.d.ts +31 -0
- package/node_modules/import-meta-resolve/lib/package-json-reader.d.ts.map +1 -0
- package/node_modules/import-meta-resolve/lib/package-json-reader.js +177 -0
- package/node_modules/import-meta-resolve/lib/resolve.d.ts +29 -0
- package/node_modules/import-meta-resolve/lib/resolve.d.ts.map +1 -0
- package/node_modules/import-meta-resolve/lib/resolve.js +1301 -0
- package/node_modules/import-meta-resolve/lib/utils.d.ts +6 -0
- package/node_modules/import-meta-resolve/lib/utils.d.ts.map +1 -0
- package/node_modules/import-meta-resolve/lib/utils.js +47 -0
- package/node_modules/import-meta-resolve/license +74 -0
- package/node_modules/import-meta-resolve/package.json +78 -0
- package/node_modules/import-meta-resolve/readme.md +252 -0
- package/package.json +30 -26
- package/packages/octo-runtime-extra-channel-gateway/config-schema.json +2 -2
- package/packages/octo-runtime-extra-channel-wecom/config-schema.json +2 -2
- package/packages/octo-runtime-extra-webui/config-schema.json +2 -2
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js
CHANGED
|
@@ -9,6 +9,7 @@ import { join } from "node:path";
|
|
|
9
9
|
import { assertContextEnvelope, mergeContext } from "@mininglamp-oss/octo-runtime-protocol";
|
|
10
10
|
import { validateImConfig } from "../lifecycle/configuration.js";
|
|
11
11
|
import { compactHistoryGap, historyGapContext } from "../application/context-gap.js";
|
|
12
|
+
import { MENTION_GUIDANCE } from "../transport/mentions.js";
|
|
12
13
|
export function createImInvocation(config, message, context, sessionKey, session, _signal, occurrenceId = message.messageId) {
|
|
13
14
|
validateImConfig(config);
|
|
14
15
|
assertContextEnvelope(context);
|
|
@@ -77,7 +78,30 @@ export function createImInvocation(config, message, context, sessionKey, session
|
|
|
77
78
|
]
|
|
78
79
|
};
|
|
79
80
|
// Channel 只组装公开 InvokeInput;执行解析和指令渲染统一交给 Host,避免再次拒绝业务 Context。
|
|
81
|
+
// 宿主已先解析静态/动态 Context;渠道默认指令只在本轮与有效 entries 保序组合一次。
|
|
82
|
+
// 不改变公共 mergeContext 或动态人设替换合同,也不把上一轮的组合结果累积回来。
|
|
80
83
|
let submitted = context;
|
|
84
|
+
// 同代次卡片重试已从 occurrence 取得组合后的冻结快照,不能再次追加或按文本去重。
|
|
85
|
+
if (!message.historyRetry) {
|
|
86
|
+
const instructions = context.items.find((item) => item.namespace === "octo.control" && item.name === "instructions");
|
|
87
|
+
const channelInstructions = {
|
|
88
|
+
namespace: "octo.control",
|
|
89
|
+
name: "instructions",
|
|
90
|
+
payload: {
|
|
91
|
+
entries: [
|
|
92
|
+
...(instructions?.payload
|
|
93
|
+
?.entries ?? []),
|
|
94
|
+
{ text: MENTION_GUIDANCE }
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
submitted = {
|
|
99
|
+
schema: context.schema,
|
|
100
|
+
items: instructions
|
|
101
|
+
? context.items.map((item) => (item === instructions ? channelInstructions : item))
|
|
102
|
+
: [...context.items, channelInstructions]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
81
105
|
let snapshot;
|
|
82
106
|
// 执行默认项也占协议预算;只降级本渠道自动追加的辅助材料,不丢弃显式业务项。
|
|
83
107
|
for (const optional of [
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getGroupMd, getThreadMd } from "./api/rules.js";
|
|
|
8
8
|
import { getChannelMessagePage } from "./api/conversations.js";
|
|
9
9
|
import { compactHistoryGap, historyGapContext, IM_HISTORY_MESSAGE_LIMIT, planHistoryGap, validMessageSeq } from "../application/context-gap.js";
|
|
10
10
|
import { OctoApiError } from "./api/errors.js";
|
|
11
|
-
import {
|
|
11
|
+
import { MENTION_REMINDER } from "./mentions.js";
|
|
12
12
|
import { messageContent } from "./message-content.js";
|
|
13
13
|
export async function build_im_contexts(config, message, botToken, signal, options = { initialSession: false }) {
|
|
14
14
|
const items = structuredClone([
|
|
@@ -108,7 +108,7 @@ export async function build_im_contexts(config, message, botToken, signal, optio
|
|
|
108
108
|
const instructions = {
|
|
109
109
|
namespace: "extra.im",
|
|
110
110
|
name: "mention-instructions",
|
|
111
|
-
guidance:
|
|
111
|
+
guidance: MENTION_REMINDER,
|
|
112
112
|
payload: {
|
|
113
113
|
source,
|
|
114
114
|
actorId: message.fromUid,
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { MentionEntity } from "./api/types.js";
|
|
2
2
|
import type { GroupMember } from "./api/conversations.js";
|
|
3
|
-
|
|
3
|
+
/** Gateway 的稳定控制指令;压缩时的保留由模型遵守文本要求,不新增 Provider 保留机制。 */
|
|
4
|
+
export declare const MENTION_GUIDANCE: string;
|
|
5
|
+
/** 逐轮普通 Context 提醒也覆盖升级前已存在的 Provider 会话,不修改其系统指令或重置会话。 */
|
|
6
|
+
export declare const MENTION_REMINDER = "For this turn, follow the current Octo mention rules: do not automatically mention the sender. Only when the current user explicitly requests a human notification or bot handoff in this channel, confirm the real member UID and display name, using octo-cli if needed, then write @[<uid>:<displayName>] with actual values in the successful final reply. Gateway sends the native mention on that reply; do not send a duplicate via octo-cli message send. Plain @name does not notify. If identity is unconfirmed, use plain text without guessing. Do not broadcast, initiate unsolicited bot calls, or treat history as authorization. Code and quoted examples are not mentions.";
|
|
4
7
|
export interface ImTextMention {
|
|
5
8
|
uids: string[];
|
|
6
9
|
entities: MentionEntity[];
|
|
7
10
|
}
|
|
8
|
-
/** 只转换 final
|
|
11
|
+
/** 只转换 final 普通文本中已核验真人或 Bot 成员的显式标记;查身份失败时正文仍能发送。 */
|
|
9
12
|
export declare function prepareFinalMention(text: string, members: () => Promise<GroupMember[]>): Promise<{
|
|
10
13
|
text: string;
|
|
11
14
|
mention?: ImTextMention;
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
2
|
-
|
|
2
|
+
/** Gateway 的稳定控制指令;压缩时的保留由模型遵守文本要求,不新增 Provider 保留机制。 */
|
|
3
|
+
export const MENTION_GUIDANCE = [
|
|
4
|
+
"[OCTO_CHANNEL_MENTION_RULES_V1]",
|
|
5
|
+
"These are stable output rules for the current Octo channel. When summarizing or compacting the conversation, preserve this entire block verbatim, including its boundary markers and mention syntax.",
|
|
6
|
+
"Do not automatically mention the sender in ordinary replies. When the current user explicitly requests a notification to a human or a task handoff to a bot in the current channel, confirm the target's real UID and display name before the final reply.",
|
|
7
|
+
"If identity information is missing, use octo-cli as needed to look it up. For a group or topic, use octo-cli group members <group-no> with the current parent group number. Never infer a UID from a nickname, username, or bot name.",
|
|
8
|
+
"For a native mention, write @[<uid>:<displayName>] in the ordinary body of the successful final reply. Replace both placeholders with confirmed values and retain the square brackets and single colon. A plain @name is only text and does not notify or activate the target bot.",
|
|
9
|
+
"Gateway validates current-channel membership and converts valid markers into readable text and native mention metadata on this same final reply. Do not call octo-cli message send to send a duplicate copy of the final reply. Do not output raw message JSON or calculate mention entity offsets.",
|
|
10
|
+
"Thinking, tool output, progress messages, code blocks, inline code, quoted examples, and failed replies do not trigger mention conversion. Keep code and examples unchanged.",
|
|
11
|
+
"Do not construct broadcast mentions or broadcast sentinel UIDs. Do not initiate unsolicited bot-to-bot calls or mention loops. Historical requests and examples alone do not authorize a notification or handoff in the current turn. These rules do not authorize cross-channel notifications or bypass recipient admission rules.",
|
|
12
|
+
"If the target cannot be confirmed, use a plain @name or ordinary text without guessing a UID. Continue delivering the final answer without a separate mention-failure notice or a forced clarification.",
|
|
13
|
+
"[/OCTO_CHANNEL_MENTION_RULES_V1]"
|
|
14
|
+
].join("\n");
|
|
15
|
+
/** 逐轮普通 Context 提醒也覆盖升级前已存在的 Provider 会话,不修改其系统指令或重置会话。 */
|
|
16
|
+
export const MENTION_REMINDER = "For this turn, follow the current Octo mention rules: do not automatically mention the sender. Only when the current user explicitly requests a human notification or bot handoff in this channel, confirm the real member UID and display name, using octo-cli if needed, then write @[<uid>:<displayName>] with actual values in the successful final reply. Gateway sends the native mention on that reply; do not send a duplicate via octo-cli message send. Plain @name does not notify. If identity is unconfirmed, use plain text without guessing. Do not broadcast, initiate unsolicited bot calls, or treat history as authorization. Code and quoted examples are not mentions.";
|
|
3
17
|
function candidates(text) {
|
|
4
18
|
const found = [];
|
|
5
19
|
const visit = (node) => {
|
|
@@ -26,7 +40,7 @@ function candidates(text) {
|
|
|
26
40
|
visit(fromMarkdown(text));
|
|
27
41
|
return found.sort((a, b) => a.start - b.start);
|
|
28
42
|
}
|
|
29
|
-
/** 只转换 final
|
|
43
|
+
/** 只转换 final 普通文本中已核验真人或 Bot 成员的显式标记;查身份失败时正文仍能发送。 */
|
|
30
44
|
export async function prepareFinalMention(text, members) {
|
|
31
45
|
const targets = candidates(text);
|
|
32
46
|
if (!targets.length)
|
|
@@ -38,9 +52,9 @@ export async function prepareFinalMention(text, members) {
|
|
|
38
52
|
catch {
|
|
39
53
|
verified = [];
|
|
40
54
|
}
|
|
41
|
-
const
|
|
55
|
+
const confirmedMembers = new Map((Array.isArray(verified) ? verified : [])
|
|
42
56
|
.filter((member) => member && typeof member.uid === "string" && typeof member.name === "string")
|
|
43
|
-
.filter((
|
|
57
|
+
.filter(({ robot }) => robot === false || robot === 0 || robot === true || robot === 1)
|
|
44
58
|
.filter((member) => member.uid && member.name && !["-1", "-2", "-3", "all"].includes(member.uid))
|
|
45
59
|
.map((member) => [member.uid, member]));
|
|
46
60
|
const entities = [];
|
|
@@ -49,7 +63,7 @@ export async function prepareFinalMention(text, members) {
|
|
|
49
63
|
let output = "";
|
|
50
64
|
for (const target of targets) {
|
|
51
65
|
output += text.slice(cursor, target.start);
|
|
52
|
-
const member =
|
|
66
|
+
const member = confirmedMembers.get(target.uid);
|
|
53
67
|
const label = `@${member?.name ?? target.name}`;
|
|
54
68
|
if (member) {
|
|
55
69
|
entities.push({ uid: member.uid, offset: output.length, length: label.length });
|
package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.js
CHANGED
|
@@ -15,6 +15,7 @@ export function observesImScope(config, channelId, channelType, spaceId) {
|
|
|
15
15
|
config.group_ids.includes(groupScope(channelId).groupNo)));
|
|
16
16
|
}
|
|
17
17
|
export function acceptsImMessage(config, owner, message) {
|
|
18
|
+
// 自己发出的消息永不触发 AgentRun,即使真实 @ 自己、@所有AI 或显式列入发送者名单。
|
|
18
19
|
if (message.fromUid === config.bot_id ||
|
|
19
20
|
isRulesNotification(message) ||
|
|
20
21
|
!message.messageId ||
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-extra-channel-gateway",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"docs"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.
|
|
22
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
23
|
-
"@mininglamp-oss/octo-runtime-executor-core": "1.1.
|
|
24
|
-
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.
|
|
25
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
21
|
+
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.2",
|
|
22
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2",
|
|
23
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.2",
|
|
24
|
+
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.2",
|
|
25
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.2",
|
|
26
26
|
"mdast-util-from-markdown": "2.1.0",
|
|
27
27
|
"ws": "8.22.0"
|
|
28
28
|
}
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"$comment": "声明文件最多 1 MiB,POSIX 权限须为 0600。Bot 按 ws_url 与 bot_id 的组合判重;凭据文件权限、目标 Agent 是否存在、Provider 是否可用等仍需运行时检查。Context 内部对象遵循 octo.context-envelope/v3,具体协议约束由现有运行时校验,本文件不重复展开。",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
|
9
|
-
"required": ["
|
|
9
|
+
"required": ["config"],
|
|
10
10
|
"properties": {
|
|
11
11
|
"module": {
|
|
12
12
|
"type": "string",
|
|
13
13
|
"const": "@mininglamp-oss/octo-runtime-extra-channel-wecom",
|
|
14
|
-
"description": "
|
|
14
|
+
"description": "可选旧声明。CLI 从 manifest.json 选择模块;省略时使用有效清单,保留时须与清单文字一致。SDK 原生 import 不需要此字段。此 schema 约束固定包名,宿主使用其他公开路径时可自行调整。"
|
|
15
15
|
},
|
|
16
16
|
"enabled": {
|
|
17
17
|
"type": "boolean",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-extra-channel-wecom",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"docs"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.
|
|
22
|
-
"@mininglamp-oss/octo-runtime-executor-core": "1.1.
|
|
23
|
-
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.
|
|
21
|
+
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.2",
|
|
22
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.2",
|
|
23
|
+
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.2",
|
|
24
24
|
"ws": "8.22.0",
|
|
25
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
25
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.2"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"$comment": "声明文件最多 1 MiB,POSIX 权限须为 0600。端口占用、路径可访问性、会话文件内容及文件权限仍需运行时检查。加载生命周期 loaded 不等于监听成功,宿主须检查插件状态中的 listening 与 errors。",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
|
9
|
-
"required": ["
|
|
9
|
+
"required": ["config"],
|
|
10
10
|
"properties": {
|
|
11
11
|
"module": {
|
|
12
12
|
"type": "string",
|
|
13
13
|
"const": "@mininglamp-oss/octo-runtime-extra-webui",
|
|
14
|
-
"description": "
|
|
14
|
+
"description": "可选旧声明。CLI 从 manifest.json 选择模块;省略时使用有效清单,保留时须与清单文字一致。SDK 原生 import 不需要此字段。此 schema 约束固定包名,宿主使用其他公开路径时可自行调整。"
|
|
15
15
|
},
|
|
16
16
|
"enabled": {
|
|
17
17
|
"type": "boolean",
|
|
@@ -73,7 +73,7 @@ async function initialize(ctx, config) {
|
|
|
73
73
|
errors.push("WEBUI_CONTEXT_INVALID");
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
const store = new SessionStore(config.sessionStorePath);
|
|
76
|
+
const store = new SessionStore(config.sessionStorePath, ctx.log);
|
|
77
77
|
try {
|
|
78
78
|
await store.open();
|
|
79
79
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RuntimeLog } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
1
2
|
export interface Session {
|
|
2
3
|
id: string;
|
|
3
4
|
title: string;
|
|
@@ -14,9 +15,11 @@ export declare function validMessages(value: unknown): value is unknown[];
|
|
|
14
15
|
export declare function validBinding(value: unknown): value is Record<string, unknown>;
|
|
15
16
|
export declare class SessionStore {
|
|
16
17
|
readonly path: string;
|
|
18
|
+
private readonly log?;
|
|
17
19
|
records: Session[];
|
|
18
20
|
private queue;
|
|
19
|
-
constructor(path: string);
|
|
21
|
+
constructor(path: string, log?: RuntimeLog | undefined);
|
|
22
|
+
private cleanupError;
|
|
20
23
|
open(): Promise<void>;
|
|
21
24
|
change<T>(operation: (records: Session[]) => T): Promise<T>;
|
|
22
25
|
}
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
import { mkdir, readFile, rename,
|
|
1
|
+
import { mkdir, open, readFile, rename, unlink } from "node:fs/promises";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
5
|
+
// 本机 Windows 的瞬态 EPERM 在约 1.6 秒后恢复;只重试替换,不重放业务变更。
|
|
6
|
+
// 最多 8 次替换、3170 ms 退避;文件系统调用和调度本身的耗时不计入退避预算。
|
|
7
|
+
const replacementDelays = [20, 50, 100, 200, 400, 800, 1600];
|
|
8
|
+
async function replace(temporary, destination) {
|
|
9
|
+
for (let attempt = 0;; attempt++) {
|
|
10
|
+
try {
|
|
11
|
+
await rename(temporary, destination);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
// 返回结束重试的实际错误及其原生字段,不能让最初的 EPERM 掩盖后续错误。
|
|
16
|
+
if (process.platform !== "win32" ||
|
|
17
|
+
error.code !== "EPERM" ||
|
|
18
|
+
attempt === replacementDelays.length)
|
|
19
|
+
throw error;
|
|
20
|
+
await delay(replacementDelays[attempt]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
4
24
|
export function validMessages(value) {
|
|
5
25
|
return (Array.isArray(value) &&
|
|
6
26
|
value.every((message) => {
|
|
@@ -24,10 +44,21 @@ export function validBinding(value) {
|
|
|
24
44
|
}
|
|
25
45
|
export class SessionStore {
|
|
26
46
|
path;
|
|
47
|
+
log;
|
|
27
48
|
records = [];
|
|
28
49
|
queue = Promise.resolve();
|
|
29
|
-
constructor(path) {
|
|
50
|
+
constructor(path, log) {
|
|
30
51
|
this.path = path;
|
|
52
|
+
this.log = log;
|
|
53
|
+
}
|
|
54
|
+
cleanupError(event, error) {
|
|
55
|
+
// 清理可能因未释放句柄等原因失败;仅报告错误码,诊断失败不能覆盖保存错误。
|
|
56
|
+
try {
|
|
57
|
+
this.log?.("warn", event, { code: error?.code });
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// 日志回调不能改变存储操作的结果。
|
|
61
|
+
}
|
|
31
62
|
}
|
|
32
63
|
async open() {
|
|
33
64
|
try {
|
|
@@ -69,8 +100,27 @@ export class SessionStore {
|
|
|
69
100
|
throw new Error("WEBUI_STORE_TOO_LARGE");
|
|
70
101
|
await mkdir(dirname(this.path), { recursive: true, mode: 0o700 });
|
|
71
102
|
const temporary = `${this.path}.${randomUUID()}.tmp`;
|
|
72
|
-
|
|
73
|
-
await
|
|
103
|
+
// 独占创建成功才取得所有权;open 失败不能删除可能属于其他写入者的文件。
|
|
104
|
+
const handle = await open(temporary, "wx", 0o600);
|
|
105
|
+
try {
|
|
106
|
+
try {
|
|
107
|
+
await handle.writeFile(text);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
await handle
|
|
111
|
+
.close()
|
|
112
|
+
.catch((closeError) => this.cleanupError("webui.store.close_failed", closeError));
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
// 关闭失败同样是保存失败,不能尝试替换或提交内存。
|
|
116
|
+
await handle.close();
|
|
117
|
+
await replace(temporary, this.path);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
await unlink(temporary).catch((cleanupError) => this.cleanupError("webui.store.temporary_cleanup_failed", cleanupError));
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
// rename 成功就是提交点;此后没有可能将成功翻转成失败的日志或清理动作。
|
|
74
124
|
this.records = next;
|
|
75
125
|
return result;
|
|
76
126
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-extra-webui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local Runtime workbench with canonical SSE presentation",
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"porting-map.md"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
22
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -6,8 +6,15 @@ export interface ExtraDescriptor {
|
|
|
6
6
|
enabled?: boolean;
|
|
7
7
|
config: JsonObject;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/** CLI 配置可由 manifest 提供模块;原生代码声明 ExtraDescriptor 仍显式指定模块。 */
|
|
10
|
+
export interface StoredExtra {
|
|
11
|
+
module?: string;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
config: JsonObject;
|
|
14
|
+
}
|
|
10
15
|
export declare function assertStoredExtra(value: unknown): asserts value is StoredExtra;
|
|
11
16
|
export declare function extraRegistration(descriptor: ExtraDescriptor): ExtraRegistration;
|
|
12
17
|
/** Called only by a host that explicitly selects this directory as its source. */
|
|
13
18
|
export declare function readExtraDirectory(directory: string): Promise<ExtraRegistration[]>;
|
|
19
|
+
/** 宿主显式选取的配置文件;保持凭据权限校验,不解析或导入模块。 */
|
|
20
|
+
export declare function readStoredExtra(directory: string, name: string): Promise<StoredExtra>;
|
|
@@ -8,7 +8,7 @@ export function assertStoredExtra(value) {
|
|
|
8
8
|
const item = value;
|
|
9
9
|
if (Object.keys(item).some((key) => !["module", "enabled", "config"].includes(key)))
|
|
10
10
|
throw new Error("EXTRA_CONFIG_FIELD_INVALID");
|
|
11
|
-
if (typeof item.module !== "string" || !validModule(item.module))
|
|
11
|
+
if (item.module !== undefined && (typeof item.module !== "string" || !validModule(item.module)))
|
|
12
12
|
throw new Error("EXTRA_MODULE_INVALID");
|
|
13
13
|
if (item.enabled !== undefined && typeof item.enabled !== "boolean")
|
|
14
14
|
throw new Error("EXTRA_ENABLED_INVALID");
|
|
@@ -35,12 +35,15 @@ export function extraRegistration(descriptor) {
|
|
|
35
35
|
assertExtraName(descriptor.name);
|
|
36
36
|
const { name, ...stored } = descriptor;
|
|
37
37
|
assertStoredExtra(stored);
|
|
38
|
+
const module = stored.module;
|
|
39
|
+
if (!module)
|
|
40
|
+
throw new Error("EXTRA_MODULE_REQUIRED");
|
|
38
41
|
return {
|
|
39
42
|
name,
|
|
40
|
-
module
|
|
43
|
+
module,
|
|
41
44
|
config: stored.config,
|
|
42
45
|
enabled: stored.enabled,
|
|
43
|
-
load: () => import(isAbsolute(
|
|
46
|
+
load: () => import(isAbsolute(module) ? pathToFileURL(module).href : module)
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
49
|
/** Called only by a host that explicitly selects this directory as its source. */
|
|
@@ -56,15 +59,14 @@ export async function readExtraDirectory(directory) {
|
|
|
56
59
|
continue;
|
|
57
60
|
assertExtraName(entry.name);
|
|
58
61
|
try {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
registrations.push(extraRegistration({ name: entry.name, ...stored }));
|
|
62
|
+
const stored = await readStoredExtra(directory, entry.name);
|
|
63
|
+
registrations.push(stored.module
|
|
64
|
+
? extraRegistration({ ...stored, name: entry.name, module: stored.module })
|
|
65
|
+
: {
|
|
66
|
+
...stored,
|
|
67
|
+
name: entry.name,
|
|
68
|
+
load: () => Promise.reject(new Error("EXTRA_MODULE_REQUIRED"))
|
|
69
|
+
});
|
|
68
70
|
}
|
|
69
71
|
catch (error) {
|
|
70
72
|
const code = error instanceof Error && /^EXTRA_[A-Z_]+$/.test(error.message)
|
|
@@ -79,6 +81,19 @@ export async function readExtraDirectory(directory) {
|
|
|
79
81
|
}
|
|
80
82
|
return registrations;
|
|
81
83
|
}
|
|
84
|
+
/** 宿主显式选取的配置文件;保持凭据权限校验,不解析或导入模块。 */
|
|
85
|
+
export async function readStoredExtra(directory, name) {
|
|
86
|
+
assertExtraName(name);
|
|
87
|
+
const file = join(directory, name, "config.json");
|
|
88
|
+
const info = await lstat(file);
|
|
89
|
+
if (!info.isFile() || (process.platform !== "win32" && info.mode & 0o077))
|
|
90
|
+
throw new Error("EXTRA_CONFIG_PERMISSIONS_INVALID");
|
|
91
|
+
if (info.size > 1024 * 1024)
|
|
92
|
+
throw new Error("EXTRA_CONFIG_TOO_LARGE");
|
|
93
|
+
const stored = JSON.parse(await readFile(file, "utf8"));
|
|
94
|
+
assertStoredExtra(stored);
|
|
95
|
+
return stored;
|
|
96
|
+
}
|
|
82
97
|
function validModule(module) {
|
|
83
98
|
if (isAbsolute(module))
|
|
84
99
|
return true;
|
|
@@ -54,6 +54,35 @@ export function createExtraService(options) {
|
|
|
54
54
|
let server;
|
|
55
55
|
let binding;
|
|
56
56
|
let release;
|
|
57
|
+
let healthTimer;
|
|
58
|
+
let healthCheck;
|
|
59
|
+
let lastAvailable;
|
|
60
|
+
const logState = (event, state, code) => logs?.extra(name)(code ? "warn" : "info", event, { state, ...(code ? { code } : {}) });
|
|
61
|
+
const kernelAvailable = () => {
|
|
62
|
+
if (healthCheck)
|
|
63
|
+
return healthCheck;
|
|
64
|
+
healthCheck = (client?.status().then((value) => value.execution_ready, () => false) ?? Promise.resolve(false))
|
|
65
|
+
.then((available) => {
|
|
66
|
+
if (!owner.signal.aborted && available !== lastAvailable) {
|
|
67
|
+
lastAvailable = available;
|
|
68
|
+
logState(available ? "kernel.available" : "kernel.unavailable", available ? "available" : "unavailable");
|
|
69
|
+
}
|
|
70
|
+
return available;
|
|
71
|
+
})
|
|
72
|
+
.finally(() => {
|
|
73
|
+
healthCheck = undefined;
|
|
74
|
+
});
|
|
75
|
+
return healthCheck;
|
|
76
|
+
};
|
|
77
|
+
const watchKernel = () => {
|
|
78
|
+
// Allow one probe at a time and schedule after settlement; emit transitions, not idle heartbeats.
|
|
79
|
+
void kernelAvailable().finally(() => {
|
|
80
|
+
if (owner.signal.aborted || !logging)
|
|
81
|
+
return;
|
|
82
|
+
healthTimer = setTimeout(watchKernel, 5000);
|
|
83
|
+
healthTimer.unref();
|
|
84
|
+
});
|
|
85
|
+
};
|
|
57
86
|
const sockets = new Set();
|
|
58
87
|
let finishClosed;
|
|
59
88
|
const closed = new Promise((resolve) => {
|
|
@@ -63,7 +92,7 @@ export function createExtraService(options) {
|
|
|
63
92
|
phase,
|
|
64
93
|
name,
|
|
65
94
|
pid: process.pid,
|
|
66
|
-
kernel_available:
|
|
95
|
+
kernel_available: await kernelAvailable(),
|
|
67
96
|
plugin: !enabled
|
|
68
97
|
? { phase: "disabled" }
|
|
69
98
|
: phase === "ready" && plugins
|
|
@@ -95,6 +124,8 @@ export function createExtraService(options) {
|
|
|
95
124
|
if (closing)
|
|
96
125
|
return closing;
|
|
97
126
|
phase = "closing";
|
|
127
|
+
logState("service.closing", phase);
|
|
128
|
+
clearTimeout(healthTimer);
|
|
98
129
|
shutdownUntil ??= shutdownDeadline();
|
|
99
130
|
const draining = beginDrain();
|
|
100
131
|
owner.abort();
|
|
@@ -139,7 +170,6 @@ export function createExtraService(options) {
|
|
|
139
170
|
});
|
|
140
171
|
});
|
|
141
172
|
client?.close();
|
|
142
|
-
await attempt("logs", () => logs?.close());
|
|
143
173
|
if (!errors.length)
|
|
144
174
|
await attempt("control-endpoint", async () => {
|
|
145
175
|
if (!release)
|
|
@@ -148,6 +178,8 @@ export function createExtraService(options) {
|
|
|
148
178
|
await rm(controlEndpoint, { force: true });
|
|
149
179
|
await release();
|
|
150
180
|
});
|
|
181
|
+
logState(errors.length ? "service.cleanup_incomplete" : "service.closed", errors.length ? "failed" : "closed", errors.length ? "EXTRA_CLEANUP_INCOMPLETE" : undefined);
|
|
182
|
+
await attempt("logs", () => logs?.close());
|
|
151
183
|
if (acquired) {
|
|
152
184
|
if (errors.length)
|
|
153
185
|
ownership.failed = true;
|
|
@@ -202,6 +234,9 @@ export function createExtraService(options) {
|
|
|
202
234
|
acquired = true;
|
|
203
235
|
client = attachKernel({ endpoint });
|
|
204
236
|
logs = new RuntimeLogging(logging);
|
|
237
|
+
logState("service.initializing", phase);
|
|
238
|
+
if (logging)
|
|
239
|
+
watchKernel();
|
|
205
240
|
plugins = new ExtraPlugins([], client, () => logs.extra(name));
|
|
206
241
|
if (enabled)
|
|
207
242
|
await plugins.load({
|
|
@@ -257,9 +292,11 @@ export function createExtraService(options) {
|
|
|
257
292
|
owner.signal.throwIfAborted();
|
|
258
293
|
}
|
|
259
294
|
phase = "ready";
|
|
295
|
+
logState("service.ready", phase);
|
|
260
296
|
})();
|
|
261
297
|
initialized = Promise.race([starting, cancelled])
|
|
262
298
|
.catch(async (error) => {
|
|
299
|
+
logState("service.failed", "failed", "SERVICE_INITIALIZATION_FAILED");
|
|
263
300
|
throw new ServiceInitializationError(error, await close());
|
|
264
301
|
})
|
|
265
302
|
.finally(() => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { RUNTIME_RUN_CONTRACT } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
|
+
export type { RuntimeLoggingOptions, ExtraStatusRecord } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
3
|
export * from "./extras.js";
|
|
3
4
|
export * from "./extra-config.js";
|
|
4
5
|
export * from "./context-loader.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-host-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
23
|
-
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.
|
|
24
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
22
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2",
|
|
23
|
+
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.2",
|
|
24
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.2"
|
|
25
25
|
},
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"files": [
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Match `import.meta.resolve` except that `parent` is required (you can pass
|
|
3
|
+
* `import.meta.url`).
|
|
4
|
+
*
|
|
5
|
+
* @param {string} specifier
|
|
6
|
+
* The module specifier to resolve relative to parent
|
|
7
|
+
* (`/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`,
|
|
8
|
+
* etc).
|
|
9
|
+
* @param {string} parent
|
|
10
|
+
* The absolute parent module URL to resolve from.
|
|
11
|
+
* You must pass `import.meta.url` or something else.
|
|
12
|
+
* @returns {string}
|
|
13
|
+
* Returns a string to a full `file:`, `data:`, or `node:` URL
|
|
14
|
+
* to the found thing.
|
|
15
|
+
*/
|
|
16
|
+
export function resolve(specifier: string, parent: string): string;
|
|
17
|
+
export { moduleResolve } from "./lib/resolve.js";
|
|
18
|
+
export type ErrnoException = import("./lib/errors.js").ErrnoException;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;GAcG;AACH,mCAXW,MAAM,UAIN,MAAM,GAGJ,MAAM,CA2BlB;;6BA7CY,OAAO,iBAAiB,EAAE,cAAc"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('./lib/errors.js').ErrnoException} ErrnoException
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {defaultResolve} from './lib/resolve.js'
|
|
6
|
+
|
|
7
|
+
export {moduleResolve} from './lib/resolve.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Match `import.meta.resolve` except that `parent` is required (you can pass
|
|
11
|
+
* `import.meta.url`).
|
|
12
|
+
*
|
|
13
|
+
* @param {string} specifier
|
|
14
|
+
* The module specifier to resolve relative to parent
|
|
15
|
+
* (`/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`,
|
|
16
|
+
* etc).
|
|
17
|
+
* @param {string} parent
|
|
18
|
+
* The absolute parent module URL to resolve from.
|
|
19
|
+
* You must pass `import.meta.url` or something else.
|
|
20
|
+
* @returns {string}
|
|
21
|
+
* Returns a string to a full `file:`, `data:`, or `node:` URL
|
|
22
|
+
* to the found thing.
|
|
23
|
+
*/
|
|
24
|
+
export function resolve(specifier, parent) {
|
|
25
|
+
if (!parent) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
'Please pass `parent`: `import-meta-resolve` cannot ponyfill that'
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
return defaultResolve(specifier, {parentURL: parent}).url
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// See: <https://github.com/nodejs/node/blob/45f5c9b/lib/internal/modules/esm/initialize_import_meta.js#L34>
|
|
35
|
+
const exception = /** @type {ErrnoException} */ (error)
|
|
36
|
+
|
|
37
|
+
if (
|
|
38
|
+
(exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' ||
|
|
39
|
+
exception.code === 'ERR_MODULE_NOT_FOUND') &&
|
|
40
|
+
typeof exception.url === 'string'
|
|
41
|
+
) {
|
|
42
|
+
return exception.url
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw error
|
|
46
|
+
}
|
|
47
|
+
}
|