Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listification #4914

Merged
merged 4 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/better-toys-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@google-labs/breadboard": minor
"@breadboard-ai/shared-ui": minor
"@breadboard-ai/jsandbox": minor
"@breadboard-ai/types": minor
"@breadboard-ai/a2": minor
---

Land early (mostly stubs) listification bits.
36 changes: 24 additions & 12 deletions packages/a2/bgl/a2.bgl.json

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions packages/a2/bgl/listification-workspace.bgl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"title": "Listification Workspace",
"description": "",
"version": "0.0.1",
"nodes": [
{
"id": "a2-ec8b61ad",
"type": "file://bgl/a2.bgl.json#daf082ca-c1aa-4aff-b2c8-abeb984ab66c",
"metadata": {
"title": "Make Text",
"visual": {
"x": 400,
"y": 540,
"collapsed": "expanded",
"outputHeight": 88
},
"userModified": false
},
"configuration": {
"description": {
"parts": [
{
"text": "Generate chapter outline for a science fiction novel. Subgenre: Space opera, galactic exploration. \nList chapter descriptions only.\n\nMake the main character's name start with the same letter as the current second of current time.\n\nAudience: Young Adult"
}
],
"role": "user"
},
"p-list": true
}
}
],
"edges": [],
"metadata": {
"visual": {
"presentation": {
"themes": {
"05a8046c-3027-4947-b708-808151f12d2c": {
"themeColors": {
"primaryColor": "#246db5",
"secondaryColor": "#5cadff",
"backgroundColor": "#ffffff",
"textColor": "#1a1a1a",
"primaryTextColor": "#ffffff"
},
"template": "basic",
"splashScreen": {
"storedData": {
"handle": "/images/app/generic-flow.jpg",
"mimeType": "image/jpeg"
}
}
}
},
"theme": "05a8046c-3027-4947-b708-808151f12d2c"
}
},
"userModified": true,
"tags": [],
"parameters": {}
},
"assets": {
"@@thumbnail": {
"metadata": {
"title": "Thumbnail",
"type": "file"
},
"data": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwIiBoZWlnaHQ9IjIwMCIgdmlld0JveD0iMCAwIDI1MCAyMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cmVjdCB4PSIxMC4wMCIKICAgICAgICAgICAgICAgICAgICB5PSIxNi44NSIKICAgICAgICAgICAgICAgICAgICB3aWR0aD0iMjMwLjAwIgogICAgICAgICAgICAgICAgICAgIGhlaWdodD0iMTY2LjMxIgogICAgICAgICAgICAgICAgICAgIHJ4PSIzLjUiCiAgICAgICAgICAgICAgICAgICAgZmlsbD0id2hpdGUiCiAgICAgICAgICAgICAgICAgICAgc3Ryb2tlPSIjNzc1N2Q5IiAvPgogICAgICAKICAgIDwvc3ZnPg=="
}
}
}
6 changes: 6 additions & 0 deletions packages/breadboard/src/data/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type {
FunctionResponseCapabilityPart,
InlineDataCapabilityPart,
JSONPart,
ListPart,
LLMContent,
NodeValue,
OutputValues,
Expand Down Expand Up @@ -68,6 +69,11 @@ export function isJSONPart(part: unknown): part is JSONPart {
return "json" in part;
}

export function isListPart(part: unknown): part is ListPart {
if (typeof part !== "object" || part === null) return false;
return "list" in part;
}

export function isLLMContent(nodeValue: unknown): nodeValue is LLMContent {
if (typeof nodeValue !== "object" || !nodeValue) return false;
if (nodeValue === null || nodeValue === undefined) return false;
Expand Down
22 changes: 12 additions & 10 deletions packages/breadboard/src/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { DefaultRunStore } from "./default-run-store.js";
import { DefaultDataStore } from "./default-data-store.js";
import { DefaultRunStore } from "./default-run-store.js";
import { DataStore, RunStore } from "./types.js";

export const createDefaultDataStore = (): DataStore => {
Expand All @@ -15,27 +15,29 @@ export const createDefaultRunStore = (): RunStore => {
return new DefaultRunStore();
};

export { inflateData, deflateData } from "./inflate-deflate.js";
export { deflateData, inflateData } from "./inflate-deflate.js";

export {
asBase64,
asBlob,
convertStoredPartsToAbsoluteUrls,
isDataCapability,
isFileDataCapabilityPart,
isFunctionCallCapabilityPart,
isFunctionResponseCapabilityPart,
isImageURL,
isInlineData,
isJSONPart,
isListPart,
isLLMContent,
isLLMContentArray,
isTextCapabilityPart,
isDataCapability,
isInlineData,
isStoredData,
isSerializedData,
isMetadataEntry,
asBlob,
asBase64,
isSerializedData,
isStoredData,
isTextCapabilityPart,
toInlineDataPart,
toStoredDataPart,
transformDataParts,
convertStoredPartsToAbsoluteUrls,
} from "./common.js";

export { transformBlobs } from "./file-system/blob-transform.js";
Expand Down
100 changes: 51 additions & 49 deletions packages/breadboard/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,63 @@
export type * from "./types.js";

export { Board } from "./board.js";
export { callHandler } from "./handler.js";
export { asRuntimeKit } from "./kits/ctors.js";
export { toMermaid } from "./mermaid.js";
export { Node } from "./node.js";
export { SchemaBuilder, combineSchemas } from "./schema.js";
export { RunResult } from "./run.js";
export { TraversalMachine } from "./traversal/machine.js";
export { MachineResult } from "./traversal/result.js";
export { traversalResultFromStack } from "./run/lifecycle.js";
export { toMermaid } from "./mermaid.js";
export { callHandler } from "./handler.js";
export { asRuntimeKit } from "./kits/ctors.js";
export { combineSchemas, SchemaBuilder } from "./schema.js";
export {
StreamCapability,
clone,
isStreamCapability,
patchReadableStream,
StreamCapability,
streamFromAsyncGen,
clone,
type StreamCapabilityType,
type PatchedReadableStream,
type StreamCapabilityType,
} from "./stream.js";
export { TraversalMachine } from "./traversal/machine.js";
export { MachineResult } from "./traversal/result.js";

// New Syntax:
export { base } from "./new/grammar/base.js";
export {
board,
code,
// TODO Alias for easier migration to the new name. Remove in a future breaking change.
board as recipe,
code,
} from "./new/grammar/board.js";
export { addKit } from "./new/grammar/kits.js";
export { base } from "./new/grammar/base.js";
export type {
NodeValue as NewNodeValue,
InputValues as NewInputValues,
OutputValues as NewOutputValues,
Serializeable,
AbstractNode,
} from "./new/runner/types.js";
export type {
Lambda,
InputsForHandler,
InputsForGraphDeclaration,
OutputsForGraphDeclaration,
NodeFactory as NewNodeFactory,
NodeProxy as __NodeProxy,
ProjectBackToOutputValues as __ProjectBackToOutputValues,
InputsForGraphDeclaration,
InputsForHandler,
InputsMaybeAsValues,
Lambda,
InputValues as NewInputValuesWithNodeFactory,
NodeFactory as NewNodeFactory,
OutputsForGraphDeclaration,
OutputsMaybeAsValues,
OutputValuesOrUnknown,
ProjectBackToOutputValues as __ProjectBackToOutputValues,
InputValues as NewInputValuesWithNodeFactory,
AbstractValue as V,
} from "./new/grammar/types.js";
export type {
AbstractNode,
InputValues as NewInputValues,
NodeValue as NewNodeValue,
OutputValues as NewOutputValues,
Serializeable,
} from "./new/runner/types.js";
export { asyncGen } from "./utils/async-gen.js";
export { hash } from "./utils/hash.js";
export { relativePath } from "./utils/relative-path.js";
export { asyncGen } from "./utils/async-gen.js";
export { Throttler } from "./utils/throttler.js";
export { type SemVer, SemanticVersioning } from "./utils/semver.js";
export type * from "./utils/typed-event-target.js";
export { SemanticVersioning, type SemVer } from "./utils/semver.js";
export type * from "./utils/template.js";
export { Template } from "./utils/template.js";
export { Throttler } from "./utils/throttler.js";
export type * from "./utils/typed-event-target.js";

/**
* Helpers for handling BreadboardCapability.
Expand All @@ -78,85 +78,87 @@ export {
/**
* The Inspector API.
*/
export * from "./inspector/types.js";
export {
inspect,
createRunObserver,
createGraphStore,
createRunObserver,
inspect,
} from "./inspector/index.js";
export * from "./inspector/types.js";
export { PortStatus } from "./inspector/types.js";

/**
* The Editor API.
*/
export type * from "./editor/types.js";
export { blank, blankLLMContent } from "./editor/index.js";
export type * from "./editor/types.js";

/**
* The Loader API
*/
export type * from "./loader/types.js";
export { createLoader } from "./loader/index.js";
export type * from "./loader/types.js";

export { formatGraphDescriptor } from "./formatter.js";

/**
* DataCapability helpers.
*/
export type * from "./data/types.js";
export {
asBase64,
asBlob,
assetsFromGraphDescriptor,
convertStoredPartsToAbsoluteUrls,
createDefaultDataStore,
createDefaultRunStore,
createEphemeralBlobStore,
createFileSystem,
deflateData,
inflateData,
isDataCapability,
isInlineData,
isStoredData,
isSerializedData,
isFileDataCapabilityPart,
isFunctionCallCapabilityPart,
isFunctionResponseCapabilityPart,
isImageURL,
isInlineData,
isJSONPart,
isListPart,
isLLMContent,
isLLMContentArray,
isMetadataEntry,
isSerializedData,
isStoredData,
isTextCapabilityPart,
toInlineDataPart,
toStoredDataPart,
createDefaultDataStore,
createDefaultRunStore,
transformBlobs,
createEphemeralBlobStore,
createFileSystem,
assetsFromGraphDescriptor,
transformDataParts,
convertStoredPartsToAbsoluteUrls,
} from "./data/index.js";
export type * from "./data/types.js";

export { ok, err } from "./data/file-system/utils.js";
export { err, ok } from "./data/file-system/utils.js";

/**
* Managed Run State API
*/
export type * from "./run/types.js";
export { createRunStateManager } from "./run/index.js";
export { invokeGraph } from "./run/invoke-graph.js";
export { runGraph } from "./run/run-graph.js";
export type * from "./run/types.js";

/**
* Conversion helpers
*/
export { sequenceEntryToHarnessRunResult } from "./inspector/run/conversions.js";

export { addSandboxedRunModule } from "./sandboxed-run-module.js";
export {
blankImperative,
defaultModuleContent,
} from "./run/run-imperative-graph.js";
export { addSandboxedRunModule } from "./sandboxed-run-module.js";

export { ConfigureSidewireTransform } from "./editor/transforms/configure-sidewire.js";
export { IsolateSelectionTransform } from "./editor/transforms/isolate-selection.js";
export { MergeGraphTransform } from "./editor/transforms/merge-graph.js";
export { MoveToGraphTransform } from "./editor/transforms/move-to-graph.js";
export { MoveToNewGraphTransform } from "./editor/transforms/move-to-new-graph.js";
export { MergeGraphTransform } from "./editor/transforms/merge-graph.js";
export { ConfigureSidewireTransform } from "./editor/transforms/configure-sidewire.js";
export { SidewireToNewGraphTransform } from "./editor/transforms/sidewire-to-new-graph.js";
Loading
Loading