@eclipse-docks/extension-ai-system 0.8.5 → 0.8.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"cognitive-extension.d.ts","sourceRoot":"","sources":["../src/cognitive-extension.ts"],"names":[],"mappings":"AAiBA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,kCAAkC,CAAC"}
1
+ {"version":3,"file":"cognitive-extension.d.ts","sourceRoot":"","sources":["../src/cognitive-extension.ts"],"names":[],"mappings":"AAkBA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,kCAAkC,CAAC"}
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ extensionRegistry.registerExtension({
9
9
  id: pkg.name,
10
10
  name: t.EXT_COGNITIVE_NAME,
11
11
  description: t.EXT_COGNITIVE_DESC,
12
- loader: () => import("./cognitive-extension-DAP_yD5Y.js"),
12
+ loader: () => import("./cognitive-extension-B3Lnw-ek.js"),
13
13
  icon: "robot"
14
14
  });
15
15
  //#endregion
@@ -0,0 +1,5 @@
1
+ import { SystemPromptEnhancer } from './specialists';
2
+ export { formatExecutionContextForPrompt, summarizeExecutionContext, } from './app-context-summary';
3
+ /** Injects live app state from {@link commandRegistry.createExecutionContext}. */
4
+ export declare const appContextPromptEnhancer: SystemPromptEnhancer;
5
+ //# sourceMappingURL=app-context-enhancer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-context-enhancer.d.ts","sourceRoot":"","sources":["../../src/runtime/app-context-enhancer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAE/B,kFAAkF;AAClF,eAAO,MAAM,wBAAwB,EAAE,oBAQtC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ExecutionContext } from '@eclipse-docks/core';
2
+ /** Serializable view of {@link ExecutionContext} (DOM hosts are not dumped). */
3
+ export declare function summarizeExecutionContext(context: ExecutionContext): Record<string, unknown>;
4
+ export declare function formatExecutionContextForPrompt(context: ExecutionContext): string;
5
+ //# sourceMappingURL=app-context-summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-context-summary.d.ts","sourceRoot":"","sources":["../../src/runtime/app-context-summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAgC5D,gFAAgF;AAChF,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuC5F;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAgBjF"}
@@ -15,4 +15,5 @@ export * from './session-workspace';
15
15
  export * from './cognitive-runtime';
16
16
  export * from './skills';
17
17
  export * from './skills-commands';
18
+ export * from './app-context-enhancer';
18
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
@@ -3694,6 +3694,87 @@ function registerSkillCommands() {
3694
3694
  });
3695
3695
  }
3696
3696
  //#endregion
3697
- export { OPEN_AI_SETTINGS_COMMAND as A, listConfiguredModelIds as C, AI_SETTINGS_EDITOR_ID as D, loadModelsCatalog as E, AI_SETTINGS_KEY as O, defaultProvidersSettings as S, detectEffortCapability as T, formatTokenCount as _, listSkillContributions as a, OpenAICompatibleProvider as b, formatSkillsPromptSection as c, resolveSkillBody as d, formatSkillForPrompt as f, formatContextPercent as g, formatBucketDetail as h, SYSTEM_SKILLS as i, TOPIC as j, AI_VIEW_NAME as k, selectRelevantSkills as l, estimateSessionContextUsage as m, CognitiveRuntime as n, registerSkillMarkdown as o, parseSkillMarkdown as p, cognitiveRuntime as r, isSkillContribution as s, registerSkillCommands as t, resolveSkill as u, ATTACHMENT_FILE_ACCEPT as v, parseModelIds as w, fetchOpenAICompatibleModels as x, readPromptAttachmentFromFile as y };
3697
+ //#region src/runtime/app-context-summary.ts
3698
+ var MAX_PROMPT_CHARS = 6e3;
3699
+ function pruneEmpty(value) {
3700
+ if (value == null) return void 0;
3701
+ if (typeof value === "string") return value.trim() ? value : void 0;
3702
+ if (typeof value === "number" || typeof value === "boolean") return value;
3703
+ if (Array.isArray(value)) {
3704
+ const next = value.map(pruneEmpty).filter((item) => item !== void 0);
3705
+ return next.length ? next : void 0;
3706
+ }
3707
+ if (typeof value !== "object") return void 0;
3708
+ const out = {};
3709
+ for (const [key, entry] of Object.entries(value)) {
3710
+ const kept = pruneEmpty(entry);
3711
+ if (kept !== void 0) out[key] = kept;
3712
+ }
3713
+ return Object.keys(out).length ? out : void 0;
3714
+ }
3715
+ function callString(target, method) {
3716
+ const fn = target?.[method];
3717
+ if (typeof fn !== "function") return void 0;
3718
+ try {
3719
+ const result = fn.call(target);
3720
+ return typeof result === "string" && result.trim() ? result : void 0;
3721
+ } catch {
3722
+ return;
3723
+ }
3724
+ }
3725
+ /** Serializable view of {@link ExecutionContext} (DOM hosts are not dumped). */
3726
+ function summarizeExecutionContext(context) {
3727
+ const part = context.activePart;
3728
+ const editor = context.activeEditor;
3729
+ return pruneEmpty({
3730
+ activePart: part ? {
3731
+ id: part.id ?? part.getAttribute?.("id") ?? void 0,
3732
+ label: part.tabContribution?.label,
3733
+ name: part.tabContribution?.name,
3734
+ element: part.localName
3735
+ } : void 0,
3736
+ activeEditor: editor ? {
3737
+ element: editor.localName,
3738
+ kind: editor.kind,
3739
+ canvasName: editor.canvasName,
3740
+ title: editor.input?.title,
3741
+ key: editor.input?.key,
3742
+ filePath: callString(editor, "getFilePath"),
3743
+ language: callString(editor, "getLanguage"),
3744
+ selection: callString(editor, "getSelection")
3745
+ } : void 0
3746
+ }) ?? {};
3747
+ }
3748
+ function formatExecutionContextForPrompt(context) {
3749
+ const summary = summarizeExecutionContext(context);
3750
+ if (!Object.keys(summary).length) return "";
3751
+ let body;
3752
+ try {
3753
+ body = JSON.stringify(summary, null, 2);
3754
+ } catch {
3755
+ return "";
3756
+ }
3757
+ if (body.length > MAX_PROMPT_CHARS) body = `${body.slice(0, MAX_PROMPT_CHARS)}…`;
3758
+ return [
3759
+ "Current app context (from commandRegistry.createExecutionContext — prefer this over guessing):",
3760
+ "```json",
3761
+ body,
3762
+ "```"
3763
+ ].join("\n");
3764
+ }
3765
+ //#endregion
3766
+ //#region src/runtime/app-context-enhancer.ts
3767
+ /** Injects live app state from {@link commandRegistry.createExecutionContext}. */
3768
+ var appContextPromptEnhancer = (prompt) => {
3769
+ try {
3770
+ const section = formatExecutionContextForPrompt(commandRegistry.createExecutionContext());
3771
+ if (!section) return prompt;
3772
+ return `${prompt}\n\n${section}`;
3773
+ } catch {
3774
+ return prompt;
3775
+ }
3776
+ };
3777
+ //#endregion
3778
+ export { AI_SETTINGS_EDITOR_ID as A, OpenAICompatibleProvider as C, parseModelIds as D, listConfiguredModelIds as E, AI_VIEW_NAME as M, OPEN_AI_SETTINGS_COMMAND as N, detectEffortCapability as O, TOPIC as P, readPromptAttachmentFromFile as S, defaultProvidersSettings as T, estimateSessionContextUsage as _, CognitiveRuntime as a, formatTokenCount as b, listSkillContributions as c, formatSkillsPromptSection as d, selectRelevantSkills as f, parseSkillMarkdown as g, formatSkillForPrompt as h, registerSkillCommands as i, AI_SETTINGS_KEY as j, loadModelsCatalog as k, registerSkillMarkdown as l, resolveSkillBody as m, formatExecutionContextForPrompt as n, cognitiveRuntime as o, resolveSkill as p, summarizeExecutionContext as r, SYSTEM_SKILLS as s, appContextPromptEnhancer as t, isSkillContribution as u, formatBucketDetail as v, fetchOpenAICompatibleModels as w, ATTACHMENT_FILE_ACCEPT as x, formatContextPercent as y };
3698
3779
 
3699
- //# sourceMappingURL=runtime-CI4JObpD.js.map
3780
+ //# sourceMappingURL=runtime-BjIW4lIh.js.map