@datalayer/agent-runtimes 1.3.44 → 1.3.45

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.
@@ -71,6 +71,12 @@ export type AppInstance = {
71
71
  deploymentUid?: string;
72
72
  /** The version that runs. */
73
73
  version?: number;
74
+ /**
75
+ * The organization it belongs to: its agent keeps to that organization's
76
+ * contexts, read by the runtime from IAM (LOOP U-31); unsaid for an
77
+ * application of nobody's organization.
78
+ */
79
+ organizationUid?: string;
74
80
  };
75
81
  export type AppRendererProps = Omit<LoopEmbedProps, 'agentId'> & {
76
82
  /** The application to render. */
@@ -212,6 +212,9 @@ export function appDatalayerCreatePayload(app, instance) {
212
212
  app_uid: instance.appUid ?? '',
213
213
  deployment_uid: instance.deploymentUid ?? '',
214
214
  version: instance.version ?? 0,
215
+ ...(instance.organizationUid
216
+ ? { organization_uid: instance.organizationUid }
217
+ : {}),
215
218
  },
216
219
  }
217
220
  : {}),
@@ -14,15 +14,23 @@ export interface AppCheck {
14
14
  * UI plugins, by the name a surface gives it.
15
15
  */
16
16
  export declare const componentNamed: (name: string) => ComponentSpec | undefined;
17
+ /** How an organization's own context is named: never a catalogue id (agentspecs' `ORGANIZATION_FRAME_PREFIX`). */
18
+ export declare const ORGANIZATION_FRAME_PREFIX = "org-";
19
+ /** Whether a reference names an organization's own context rather than the catalogue's (LOOP U-32). */
20
+ export declare const isOrganizationFrame: (ref: string) => boolean;
17
21
  /** The Guards the runtime executes (agent-runtimes `loop/apps/guards.py`). */
18
22
  export declare const EXECUTED_GUARDS: readonly string[];
19
23
  /**
20
24
  * Where an application is checked: the plugins its organization has turned
21
25
  * off (catalogue ids, `plugins_off` in IAM), none when it has decided nothing
22
- * or the checks run with no organization.
26
+ * or the checks run with no organization; and the ids of its organization's
27
+ * contexts (`frames` in IAM: its versions and its own, LOOP U-32), unsaid
28
+ * when no organization is known — a context of an organization's own is then
29
+ * refused.
23
30
  */
24
31
  export interface CheckContext {
25
32
  pluginsOff: readonly string[];
33
+ organizationFrames?: readonly string[];
26
34
  }
27
35
  /** The instant checks of an application as an editor holds it. */
28
36
  export declare function checkApp(app: AppSpec, read?: string[], context?: CheckContext): AppCheck;
@@ -134,8 +134,16 @@ function shapeProblems(app) {
134
134
  }
135
135
  return problems;
136
136
  }
137
- /** Every reference that does not resolve, in sentences. */
138
- function referenceProblems(app) {
137
+ /** How an organization's own context is named: never a catalogue id (agentspecs' `ORGANIZATION_FRAME_PREFIX`). */
138
+ export const ORGANIZATION_FRAME_PREFIX = 'org-';
139
+ /** Whether a reference names an organization's own context rather than the catalogue's (LOOP U-32). */
140
+ export const isOrganizationFrame = (ref) => idOf(ref).startsWith(ORGANIZATION_FRAME_PREFIX);
141
+ /**
142
+ * Every reference that does not resolve, in sentences. A context of an
143
+ * organization's own resolves among `organizationFrames`, the contexts of the
144
+ * organization the application belongs to; with none known, it is refused.
145
+ */
146
+ function referenceProblems(app, organizationFrames) {
139
147
  const problems = [];
140
148
  const missing = (what, ref) => problems.push(`There is no ${what} named “${ref}”.`);
141
149
  if (app.agent && !getAgentspecs(idOf(app.agent)) && !getCog(app.agent)) {
@@ -145,8 +153,16 @@ function referenceProblems(app) {
145
153
  missing('team', app.team);
146
154
  }
147
155
  for (const ref of app.context) {
148
- if (!getFrame(idOf(ref)))
149
- missing('Frame', ref);
156
+ if (!isOrganizationFrame(ref)) {
157
+ if (!getFrame(idOf(ref)))
158
+ missing('Frame', ref);
159
+ }
160
+ else if (organizationFrames === undefined) {
161
+ problems.push(`“${ref}” is a context of an organization’s own: it is checked with the organization the application belongs to, which was not said.`);
162
+ }
163
+ else if (!organizationFrames.includes(idOf(ref))) {
164
+ problems.push(`Its organization has no context named “${ref}”.`);
165
+ }
150
166
  }
151
167
  for (const connection of app.connections) {
152
168
  if (!own(MCP_SERVER_LIBRARY, idOf(connection.server))) {
@@ -340,7 +356,11 @@ function setupNotes(app) {
340
356
  const NO_ORGANIZATION = { pluginsOff: [] };
341
357
  /** The instant checks of an application as an editor holds it. */
342
358
  export function checkApp(app, read = [], context = NO_ORGANIZATION) {
343
- const problems = [...read, ...shapeProblems(app), ...referenceProblems(app)];
359
+ const problems = [
360
+ ...read,
361
+ ...shapeProblems(app),
362
+ ...referenceProblems(app, context.organizationFrames),
363
+ ];
344
364
  // A block its page uses from a plugin its organization turned off is said
345
365
  // with the rest of what is not enabled today (C-12).
346
366
  const setup = [
@@ -72,4 +72,4 @@ export { EMBED_ATTRIBUTES, EMBED_HOST_VARIABLES, EMBED_TAG, embedLookOf, embedSn
72
72
  export { SubagentActivityPlugin, SubagentPulse, SUBAGENT_ACTIVITY_PLUGIN_NAME, } from './plugins/subagent-activity';
73
73
  export { loopPlugins, type LoopPresetOptions } from './presets';
74
74
  export { DocumentExtension, NotebookExtension } from './extensions';
75
- export { BEHAVIOURS as APP_BEHAVIOUR_ORDER, DEFAULT_BEHAVIOURS as APP_DEFAULT_BEHAVIOURS, behaviourFor, classesOf, isReadOnly, toolBehaviours, toolEscalations, type BehaviourOptions, type ToolArguments, APP_SCHEMA, APPSPEC_KEY_ORDER, DEFAULT_LAYOUTS as APP_DEFAULT_LAYOUTS, dumpAppspec, emptyAppspec, parseAppspec, AppRenderer, checkApp, checkAppspec, type AppCheck, type CheckContext, defineAppPlugin, type AppRendererProps, type AppInstance, appLayoutOptions, readAppspecYaml, writeAppspecYaml, type ParsedAppspec, } from './apps';
75
+ export { BEHAVIOURS as APP_BEHAVIOUR_ORDER, DEFAULT_BEHAVIOURS as APP_DEFAULT_BEHAVIOURS, behaviourFor, classesOf, isReadOnly, toolBehaviours, toolEscalations, type BehaviourOptions, type ToolArguments, APP_SCHEMA, APPSPEC_KEY_ORDER, DEFAULT_LAYOUTS as APP_DEFAULT_LAYOUTS, dumpAppspec, emptyAppspec, parseAppspec, AppRenderer, checkApp, checkAppspec, isOrganizationFrame, ORGANIZATION_FRAME_PREFIX, type AppCheck, type CheckContext, defineAppPlugin, type AppRendererProps, type AppInstance, appLayoutOptions, readAppspecYaml, writeAppspecYaml, type ParsedAppspec, } from './apps';
package/lib/loop/index.js CHANGED
@@ -98,4 +98,4 @@ export { loopPlugins } from './presets';
98
98
  export { DocumentExtension, NotebookExtension } from './extensions';
99
99
  // Applications: what one does when its agent calls a tool — the rules a
100
100
  // person wrote, decided on what the tool does.
101
- export { BEHAVIOURS as APP_BEHAVIOUR_ORDER, DEFAULT_BEHAVIOURS as APP_DEFAULT_BEHAVIOURS, behaviourFor, classesOf, isReadOnly, toolBehaviours, toolEscalations, APP_SCHEMA, APPSPEC_KEY_ORDER, DEFAULT_LAYOUTS as APP_DEFAULT_LAYOUTS, dumpAppspec, emptyAppspec, parseAppspec, AppRenderer, checkApp, checkAppspec, defineAppPlugin, appLayoutOptions, readAppspecYaml, writeAppspecYaml, } from './apps';
101
+ export { BEHAVIOURS as APP_BEHAVIOUR_ORDER, DEFAULT_BEHAVIOURS as APP_DEFAULT_BEHAVIOURS, behaviourFor, classesOf, isReadOnly, toolBehaviours, toolEscalations, APP_SCHEMA, APPSPEC_KEY_ORDER, DEFAULT_LAYOUTS as APP_DEFAULT_LAYOUTS, dumpAppspec, emptyAppspec, parseAppspec, AppRenderer, checkApp, checkAppspec, isOrganizationFrame, ORGANIZATION_FRAME_PREFIX, defineAppPlugin, appLayoutOptions, readAppspecYaml, writeAppspecYaml, } from './apps';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.3.44",
3
+ "version": "1.3.45",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",