@wingman-ai/gateway 0.5.4 → 0.6.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.
Files changed (41) hide show
  1. package/dist/agent/backend/filtered-backend.cjs +130 -0
  2. package/dist/agent/backend/filtered-backend.d.ts +10 -0
  3. package/dist/agent/backend/filtered-backend.js +87 -0
  4. package/dist/agent/middleware/additional-messages.cjs +4 -1
  5. package/dist/agent/middleware/additional-messages.js +4 -1
  6. package/dist/agent/tools/browser_control.cjs +1 -1
  7. package/dist/agent/tools/browser_control.js +1 -1
  8. package/dist/agent/tools/browser_runtime.cjs +184 -15
  9. package/dist/agent/tools/browser_runtime.d.ts +59 -2
  10. package/dist/agent/tools/browser_runtime.js +182 -16
  11. package/dist/agent/tools/browser_session.cjs +44 -8
  12. package/dist/agent/tools/browser_session.d.ts +68 -123
  13. package/dist/agent/tools/browser_session.js +45 -9
  14. package/dist/agent/tools/browser_session_manager.cjs +15 -4
  15. package/dist/agent/tools/browser_session_manager.d.ts +8 -2
  16. package/dist/agent/tools/browser_session_manager.js +15 -4
  17. package/dist/cli/commands/init.cjs +80 -102
  18. package/dist/cli/commands/init.js +80 -102
  19. package/dist/cli/core/agentInvoker.cjs +4 -2
  20. package/dist/cli/core/agentInvoker.js +4 -2
  21. package/dist/cli/core/sessionManager.cjs +208 -41
  22. package/dist/cli/core/sessionManager.d.ts +20 -0
  23. package/dist/cli/core/sessionManager.js +208 -41
  24. package/dist/cli/index.cjs +16 -1
  25. package/dist/cli/index.js +16 -1
  26. package/dist/cli/services/updateCheck.cjs +212 -0
  27. package/dist/cli/services/updateCheck.d.ts +26 -0
  28. package/dist/cli/services/updateCheck.js +166 -0
  29. package/dist/gateway/server.cjs +7 -0
  30. package/dist/gateway/server.js +7 -0
  31. package/dist/webui/assets/index-D3x3G75t.css +11 -0
  32. package/dist/webui/assets/index-UpMmcU1f.js +215 -0
  33. package/dist/webui/index.html +2 -2
  34. package/package.json +3 -3
  35. package/templates/agents/README.md +1 -0
  36. package/templates/agents/game-dev/agent.md +1 -0
  37. package/templates/agents/main/agent.md +3 -3
  38. package/templates/agents/researcher/agent.md +5 -5
  39. package/dist/webui/assets/index-XrEnkZiq.css +0 -11
  40. package/dist/webui/assets/index-mDs6HbKM.js +0 -215
  41. package/dist/webui/assets/wingman_logo-Cogyt3qm.webp +0 -0
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ BLOCKED_BACKEND_PATH_MESSAGE: ()=>BLOCKED_BACKEND_PATH_MESSAGE,
28
+ DEFAULT_HIDDEN_BACKEND_SEGMENTS: ()=>DEFAULT_HIDDEN_BACKEND_SEGMENTS,
29
+ createFilteredBackend: ()=>createFilteredBackend,
30
+ pathUsesHiddenSegment: ()=>pathUsesHiddenSegment
31
+ });
32
+ const external_node_path_namespaceObject = require("node:path");
33
+ function _define_property(obj, key, value) {
34
+ if (key in obj) Object.defineProperty(obj, key, {
35
+ value: value,
36
+ enumerable: true,
37
+ configurable: true,
38
+ writable: true
39
+ });
40
+ else obj[key] = value;
41
+ return obj;
42
+ }
43
+ const DEFAULT_HIDDEN_BACKEND_SEGMENTS = [
44
+ "conversation_history"
45
+ ];
46
+ const BLOCKED_BACKEND_PATH_MESSAGE = "Access to conversation history archives is unavailable to agent file tools. Use the current thread context or /memories/ instead.";
47
+ const normalizeSegment = (value)=>value.trim().replace(/\\/g, "/").replace(/^\/+|\/+$/g, "").toLowerCase();
48
+ const normalizeVirtualPath = (value)=>{
49
+ const normalized = value.replace(/\\/g, "/").trim();
50
+ if (!normalized) return "/";
51
+ if (normalized.startsWith("/")) return external_node_path_namespaceObject.posix.normalize(normalized);
52
+ return external_node_path_namespaceObject.posix.normalize(`/${normalized.replace(/^\.?\//, "")}`);
53
+ };
54
+ const resolveHiddenSegments = (segments)=>{
55
+ const normalized = [
56
+ ...segments
57
+ ].map(normalizeSegment).filter((segment)=>segment.length > 0);
58
+ return new Set(normalized);
59
+ };
60
+ const getPathSegments = (value)=>normalizeVirtualPath(value).split("/").map((segment)=>segment.trim().toLowerCase()).filter(Boolean);
61
+ const pathUsesHiddenSegment = (value, hiddenPathSegments = DEFAULT_HIDDEN_BACKEND_SEGMENTS)=>{
62
+ const hiddenSegments = resolveHiddenSegments(hiddenPathSegments);
63
+ if (0 === hiddenSegments.size) return false;
64
+ return getPathSegments(value).some((segment)=>hiddenSegments.has(segment));
65
+ };
66
+ const filterPathEntries = (entries, hiddenSegments)=>entries.filter((entry)=>!getPathSegments(entry.path).some((segment)=>hiddenSegments.has(segment)));
67
+ const createBlockedResult = (path, message)=>({
68
+ error: message,
69
+ path,
70
+ filesUpdate: null
71
+ });
72
+ class FilteredBackend {
73
+ isHiddenPath(value) {
74
+ return this.hiddenSegments.size > 0 && getPathSegments(value).some((segment)=>this.hiddenSegments.has(segment));
75
+ }
76
+ async lsInfo(path) {
77
+ if (this.isHiddenPath(path)) return [];
78
+ const entries = await this.delegate.lsInfo(path);
79
+ return filterPathEntries(entries, this.hiddenSegments);
80
+ }
81
+ async read(filePath, offset, limit) {
82
+ if (this.isHiddenPath(filePath)) return this.blockedPathMessage;
83
+ return await this.delegate.read(filePath, offset, limit);
84
+ }
85
+ async readRaw(filePath) {
86
+ if (this.isHiddenPath(filePath)) throw new Error(this.blockedPathMessage);
87
+ return await this.delegate.readRaw(filePath);
88
+ }
89
+ async grepRaw(pattern, path, glob) {
90
+ if ("string" == typeof path && this.isHiddenPath(path)) return [];
91
+ const result = await this.delegate.grepRaw(pattern, path, glob);
92
+ if ("string" == typeof result) return result;
93
+ return filterPathEntries(result, this.hiddenSegments);
94
+ }
95
+ async globInfo(pattern, path = "/") {
96
+ if (this.isHiddenPath(path)) return [];
97
+ const entries = await this.delegate.globInfo(pattern, path);
98
+ return filterPathEntries(entries, this.hiddenSegments);
99
+ }
100
+ async write(filePath, content) {
101
+ if (this.isHiddenPath(filePath)) return createBlockedResult(filePath, this.blockedPathMessage);
102
+ return await this.delegate.write(filePath, content);
103
+ }
104
+ async edit(filePath, oldString, newString, replaceAll) {
105
+ if (this.isHiddenPath(filePath)) return createBlockedResult(filePath, this.blockedPathMessage);
106
+ return await this.delegate.edit(filePath, oldString, newString, replaceAll);
107
+ }
108
+ constructor(delegate, options = {}){
109
+ _define_property(this, "delegate", void 0);
110
+ _define_property(this, "hiddenSegments", void 0);
111
+ _define_property(this, "blockedPathMessage", void 0);
112
+ this.delegate = delegate;
113
+ this.hiddenSegments = resolveHiddenSegments(options.hiddenPathSegments ?? DEFAULT_HIDDEN_BACKEND_SEGMENTS);
114
+ this.blockedPathMessage = options.blockedPathMessage ?? BLOCKED_BACKEND_PATH_MESSAGE;
115
+ }
116
+ }
117
+ const createFilteredBackend = (delegate, options = {})=>new FilteredBackend(delegate, options);
118
+ exports.BLOCKED_BACKEND_PATH_MESSAGE = __webpack_exports__.BLOCKED_BACKEND_PATH_MESSAGE;
119
+ exports.DEFAULT_HIDDEN_BACKEND_SEGMENTS = __webpack_exports__.DEFAULT_HIDDEN_BACKEND_SEGMENTS;
120
+ exports.createFilteredBackend = __webpack_exports__.createFilteredBackend;
121
+ exports.pathUsesHiddenSegment = __webpack_exports__.pathUsesHiddenSegment;
122
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
123
+ "BLOCKED_BACKEND_PATH_MESSAGE",
124
+ "DEFAULT_HIDDEN_BACKEND_SEGMENTS",
125
+ "createFilteredBackend",
126
+ "pathUsesHiddenSegment"
127
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
128
+ Object.defineProperty(exports, '__esModule', {
129
+ value: true
130
+ });
@@ -0,0 +1,10 @@
1
+ import type { BackendProtocol } from "deepagents";
2
+ export declare const DEFAULT_HIDDEN_BACKEND_SEGMENTS: readonly ["conversation_history"];
3
+ export declare const BLOCKED_BACKEND_PATH_MESSAGE = "Access to conversation history archives is unavailable to agent file tools. Use the current thread context or /memories/ instead.";
4
+ type FilteredBackendOptions = {
5
+ hiddenPathSegments?: Iterable<string>;
6
+ blockedPathMessage?: string;
7
+ };
8
+ export declare const pathUsesHiddenSegment: (value: string, hiddenPathSegments?: Iterable<string>) => boolean;
9
+ export declare const createFilteredBackend: (delegate: BackendProtocol, options?: FilteredBackendOptions) => BackendProtocol;
10
+ export {};
@@ -0,0 +1,87 @@
1
+ import { posix } from "node:path";
2
+ function _define_property(obj, key, value) {
3
+ if (key in obj) Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ else obj[key] = value;
10
+ return obj;
11
+ }
12
+ const DEFAULT_HIDDEN_BACKEND_SEGMENTS = [
13
+ "conversation_history"
14
+ ];
15
+ const BLOCKED_BACKEND_PATH_MESSAGE = "Access to conversation history archives is unavailable to agent file tools. Use the current thread context or /memories/ instead.";
16
+ const normalizeSegment = (value)=>value.trim().replace(/\\/g, "/").replace(/^\/+|\/+$/g, "").toLowerCase();
17
+ const normalizeVirtualPath = (value)=>{
18
+ const normalized = value.replace(/\\/g, "/").trim();
19
+ if (!normalized) return "/";
20
+ if (normalized.startsWith("/")) return posix.normalize(normalized);
21
+ return posix.normalize(`/${normalized.replace(/^\.?\//, "")}`);
22
+ };
23
+ const resolveHiddenSegments = (segments)=>{
24
+ const normalized = [
25
+ ...segments
26
+ ].map(normalizeSegment).filter((segment)=>segment.length > 0);
27
+ return new Set(normalized);
28
+ };
29
+ const getPathSegments = (value)=>normalizeVirtualPath(value).split("/").map((segment)=>segment.trim().toLowerCase()).filter(Boolean);
30
+ const pathUsesHiddenSegment = (value, hiddenPathSegments = DEFAULT_HIDDEN_BACKEND_SEGMENTS)=>{
31
+ const hiddenSegments = resolveHiddenSegments(hiddenPathSegments);
32
+ if (0 === hiddenSegments.size) return false;
33
+ return getPathSegments(value).some((segment)=>hiddenSegments.has(segment));
34
+ };
35
+ const filterPathEntries = (entries, hiddenSegments)=>entries.filter((entry)=>!getPathSegments(entry.path).some((segment)=>hiddenSegments.has(segment)));
36
+ const createBlockedResult = (path, message)=>({
37
+ error: message,
38
+ path,
39
+ filesUpdate: null
40
+ });
41
+ class FilteredBackend {
42
+ isHiddenPath(value) {
43
+ return this.hiddenSegments.size > 0 && getPathSegments(value).some((segment)=>this.hiddenSegments.has(segment));
44
+ }
45
+ async lsInfo(path) {
46
+ if (this.isHiddenPath(path)) return [];
47
+ const entries = await this.delegate.lsInfo(path);
48
+ return filterPathEntries(entries, this.hiddenSegments);
49
+ }
50
+ async read(filePath, offset, limit) {
51
+ if (this.isHiddenPath(filePath)) return this.blockedPathMessage;
52
+ return await this.delegate.read(filePath, offset, limit);
53
+ }
54
+ async readRaw(filePath) {
55
+ if (this.isHiddenPath(filePath)) throw new Error(this.blockedPathMessage);
56
+ return await this.delegate.readRaw(filePath);
57
+ }
58
+ async grepRaw(pattern, path, glob) {
59
+ if ("string" == typeof path && this.isHiddenPath(path)) return [];
60
+ const result = await this.delegate.grepRaw(pattern, path, glob);
61
+ if ("string" == typeof result) return result;
62
+ return filterPathEntries(result, this.hiddenSegments);
63
+ }
64
+ async globInfo(pattern, path = "/") {
65
+ if (this.isHiddenPath(path)) return [];
66
+ const entries = await this.delegate.globInfo(pattern, path);
67
+ return filterPathEntries(entries, this.hiddenSegments);
68
+ }
69
+ async write(filePath, content) {
70
+ if (this.isHiddenPath(filePath)) return createBlockedResult(filePath, this.blockedPathMessage);
71
+ return await this.delegate.write(filePath, content);
72
+ }
73
+ async edit(filePath, oldString, newString, replaceAll) {
74
+ if (this.isHiddenPath(filePath)) return createBlockedResult(filePath, this.blockedPathMessage);
75
+ return await this.delegate.edit(filePath, oldString, newString, replaceAll);
76
+ }
77
+ constructor(delegate, options = {}){
78
+ _define_property(this, "delegate", void 0);
79
+ _define_property(this, "hiddenSegments", void 0);
80
+ _define_property(this, "blockedPathMessage", void 0);
81
+ this.delegate = delegate;
82
+ this.hiddenSegments = resolveHiddenSegments(options.hiddenPathSegments ?? DEFAULT_HIDDEN_BACKEND_SEGMENTS);
83
+ this.blockedPathMessage = options.blockedPathMessage ?? BLOCKED_BACKEND_PATH_MESSAGE;
84
+ }
85
+ }
86
+ const createFilteredBackend = (delegate, options = {})=>new FilteredBackend(delegate, options);
87
+ export { BLOCKED_BACKEND_PATH_MESSAGE, DEFAULT_HIDDEN_BACKEND_SEGMENTS, createFilteredBackend, pathUsesHiddenSegment };
@@ -27,6 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  additionalMessageMiddleware: ()=>additionalMessageMiddleware
28
28
  });
29
29
  const external_node_path_namespaceObject = require("node:path");
30
+ const messages_namespaceObject = require("@langchain/core/messages");
30
31
  const external_langchain_namespaceObject = require("langchain");
31
32
  const external_utils_cjs_namespaceObject = require("../utils.cjs");
32
33
  const external_uiRegistry_cjs_namespaceObject = require("../uiRegistry.cjs");
@@ -57,6 +58,7 @@ const buildWorkingDirectoryMessage = (context)=>{
57
58
  if (!context.workspaceRoot) return null;
58
59
  return "** Working Directory **\n- Treat `./` as the current working directory for file and tool operations in this session.\n- Use relative paths such as `./test.md`; do not prepend the working directory absolute path.";
59
60
  };
61
+ const buildSessionArtifactsMessage = ()=>"** Session Artifacts **\n- Treat /conversation_history as an internal summarization archive, not working context.\n- Do not inspect conversation history files through file tools or shell commands during normal task work.\n- Prefer the current thread state and /memories/ for durable context.";
60
62
  const resolveConnectedNodeIds = async (context)=>{
61
63
  if (context.nodeConnectedTargetsProvider) try {
62
64
  const rawTargets = await context.nodeConnectedTargetsProvider();
@@ -167,6 +169,7 @@ const additionalMessageMiddleware = (context = {})=>({
167
169
  if (outputLocation) lines.push(outputLocation);
168
170
  const workingDirectory = buildWorkingDirectoryMessage(context);
169
171
  if (workingDirectory) lines.push(workingDirectory);
172
+ lines.push(buildSessionArtifactsMessage());
170
173
  const nodeTargets = await buildNodeTargetsMessage(context);
171
174
  if (nodeTargets) lines.push(nodeTargets);
172
175
  lines.push("** Long-term memory **\n- Use /memories/ for durable notes across threads.\n- Store stable preferences, project context, decisions, and research notes.\n- Avoid transient logs; keep entries concise and organized.\n- Suggested paths: /memories/preferences.md, /memories/projects/<name>/context.md, /memories/projects/<name>/decisions.md");
@@ -184,7 +187,7 @@ const additionalMessageMiddleware = (context = {})=>({
184
187
  return {
185
188
  ...input,
186
189
  messages: [
187
- new external_langchain_namespaceObject.HumanMessage({
190
+ new messages_namespaceObject.HumanMessage({
188
191
  content: lines.join("\n\n"),
189
192
  additional_kwargs: {
190
193
  ui_hidden: true,
@@ -1,5 +1,6 @@
1
1
  import { isAbsolute, relative } from "node:path";
2
- import { HumanMessage, MIDDLEWARE_BRAND } from "langchain";
2
+ import { HumanMessage } from "@langchain/core/messages";
3
+ import { MIDDLEWARE_BRAND } from "langchain";
3
4
  import { getConfidentialityNotice } from "../utils.js";
4
5
  import { loadUiRegistry, resolveUiRegistryPath, summarizeUiRegistry } from "../uiRegistry.js";
5
6
  const INJECTION_SOURCE = "additional-message-middleware";
@@ -29,6 +30,7 @@ const buildWorkingDirectoryMessage = (context)=>{
29
30
  if (!context.workspaceRoot) return null;
30
31
  return "** Working Directory **\n- Treat `./` as the current working directory for file and tool operations in this session.\n- Use relative paths such as `./test.md`; do not prepend the working directory absolute path.";
31
32
  };
33
+ const buildSessionArtifactsMessage = ()=>"** Session Artifacts **\n- Treat /conversation_history as an internal summarization archive, not working context.\n- Do not inspect conversation history files through file tools or shell commands during normal task work.\n- Prefer the current thread state and /memories/ for durable context.";
32
34
  const resolveConnectedNodeIds = async (context)=>{
33
35
  if (context.nodeConnectedTargetsProvider) try {
34
36
  const rawTargets = await context.nodeConnectedTargetsProvider();
@@ -139,6 +141,7 @@ const additionalMessageMiddleware = (context = {})=>({
139
141
  if (outputLocation) lines.push(outputLocation);
140
142
  const workingDirectory = buildWorkingDirectoryMessage(context);
141
143
  if (workingDirectory) lines.push(workingDirectory);
144
+ lines.push(buildSessionArtifactsMessage());
142
145
  const nodeTargets = await buildNodeTargetsMessage(context);
143
146
  if (nodeTargets) lines.push(nodeTargets);
144
147
  lines.push("** Long-term memory **\n- Use /memories/ for durable notes across threads.\n- Store stable preferences, project context, decisions, and research notes.\n- Avoid transient logs; keep entries concise and organized.\n- Suggested paths: /memories/preferences.md, /memories/projects/<name>/context.md, /memories/projects/<name>/decisions.md");
@@ -46,7 +46,7 @@ const createBrowserControlTool = (options = {}, dependencies = {})=>(0, external
46
46
  }
47
47
  }, {
48
48
  name: "browser_control",
49
- description: 'Native browser automation for Wingman using Chrome/Chromium runtime control. Transport is selected by config or the optional input override ("auto", "playwright", or "relay"): Playwright persistent-context is preferred for persistent profiles, CDP is used for standard runs with persistent-context fallback, and relay can bridge a live extension-attached tab. This is a first-class runtime capability, not an MCP server. Use it for JavaScript-rendered pages, interactions, screenshots, and structured extraction.',
49
+ description: 'Use this only when the user explicitly wants you to use or take over their existing browser, live tab, or extension-attached session (for example: "use my browser" or "take control of my browser"). Transport is selected by config or the optional input override ("auto", "playwright", or "relay"): Playwright persistent-context is preferred for persistent profiles, CDP is used for standard runs with persistent-context fallback, and relay can bridge a live extension-attached tab. For normal browser automation, screenshots, and QA, prefer browser_session_start/browser_session_action/browser_session_close.',
50
50
  schema: external_browser_runtime_cjs_namespaceObject.BrowserControlInputSchema
51
51
  });
52
52
  exports.clearStaleDevtoolsArtifacts = __webpack_exports__.clearStaleDevtoolsArtifacts;
@@ -17,7 +17,7 @@ const createBrowserControlTool = (options = {}, dependencies = {})=>tool(async (
17
17
  }
18
18
  }, {
19
19
  name: "browser_control",
20
- description: 'Native browser automation for Wingman using Chrome/Chromium runtime control. Transport is selected by config or the optional input override ("auto", "playwright", or "relay"): Playwright persistent-context is preferred for persistent profiles, CDP is used for standard runs with persistent-context fallback, and relay can bridge a live extension-attached tab. This is a first-class runtime capability, not an MCP server. Use it for JavaScript-rendered pages, interactions, screenshots, and structured extraction.',
20
+ description: 'Use this only when the user explicitly wants you to use or take over their existing browser, live tab, or extension-attached session (for example: "use my browser" or "take control of my browser"). Transport is selected by config or the optional input override ("auto", "playwright", or "relay"): Playwright persistent-context is preferred for persistent profiles, CDP is used for standard runs with persistent-context fallback, and relay can bridge a live extension-attached tab. For normal browser automation, screenshots, and QA, prefer browser_session_start/browser_session_action/browser_session_close.',
21
21
  schema: BrowserControlInputSchema
22
22
  });
23
23
  export { clearStaleDevtoolsArtifacts, createBrowserControlTool };