@omercnet/paseo-context-mode 2.0.0 → 2.0.1-next.247.1
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/client/screen-scope.ts +11 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/client/screen-scope.ts
CHANGED
|
@@ -20,14 +20,22 @@ export function parseScreenParams(params: Record<string, string>): ScreenParams
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// Screen params survive the host switcher and shared links, so the id may belong to another host.
|
|
24
|
+
function notOnThisHost(kind: "agent" | "workspace"): KnowledgeScope {
|
|
25
|
+
return {
|
|
26
|
+
provider: null,
|
|
27
|
+
projectPath: "",
|
|
28
|
+
note: `The ${kind} this screen was opened from is not on this host. Select a provider and project.`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
export async function resolveKnowledgeScope(
|
|
24
33
|
paseo: PaseoApi,
|
|
25
34
|
params: ScreenParams,
|
|
26
35
|
): Promise<KnowledgeScope> {
|
|
27
36
|
if (params.agentId) {
|
|
28
37
|
const result = await paseo.agents.ref(params.agentId).refresh();
|
|
29
|
-
if (!result)
|
|
30
|
-
throw new Error("Agent not found on this host. Select a provider and project explicitly.");
|
|
38
|
+
if (!result) return notOnThisHost("agent");
|
|
31
39
|
if (params.workspaceId && result.agent.workspaceId !== params.workspaceId) {
|
|
32
40
|
throw new Error(
|
|
33
41
|
"Agent no longer belongs to this workspace. Select a provider and project explicitly.",
|
|
@@ -38,8 +46,7 @@ export async function resolveKnowledgeScope(
|
|
|
38
46
|
const workspace = params.workspaceId
|
|
39
47
|
? await paseo.workspaces.ref(params.workspaceId).refresh()
|
|
40
48
|
: null;
|
|
41
|
-
if (!workspace)
|
|
42
|
-
throw new Error("Workspace not found on this host. Select a provider and project explicitly.");
|
|
49
|
+
if (!workspace) return notOnThisHost("workspace");
|
|
43
50
|
return {
|
|
44
51
|
provider: null,
|
|
45
52
|
projectPath: workspace.workspaceDirectory,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-context-mode",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@omercnet/paseo-context-mode",
|
|
9
|
-
"version": "2.0.
|
|
9
|
+
"version": "2.0.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"context-mode": "1.0.169"
|
|
12
12
|
}
|